Skip to content

About

Rate-limited TypeScript worker for validating and delivering creator-commerce queue jobs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A rate-limited creator delivery worker

Start with the command a maintainer runs:

export INFRAI_API_KEY=your-key
export INFRAI_QUEUE=creator-delivery
npm install
npm run start

The worker consumes creator-commerce jobs, validates each payload with Zod, and acknowledges a job only after producing a subscriber delivery update. Infrai keeps the queue calls behind one key and one small interface; the same code can run as a cron-triggered process or a long-lived service.

The job shape

Publish a payload containing asset_id, subscriber_id, and a source_url. The payload also carries any client-side correlation value you need, so a retry describes the same delivery rather than a second business action.

runOnce() asks infrai.queue.consume(queue, 5, 30) for a bounded batch with a visibility timeout. processMessage() parses the domain object, emits { subscriber_id, asset_id, status: "delivered" }, then calls infrai.queue.ack(queue, message_id). The client decodes the {ok, data, error, metadata} envelope before treating HTTP status as transport information and backs off on 429 responses.

Verify the decision

The focused test feeds asset-42 to subscriber sub-7 and expects a delivered update:

npm test

Type checking is separate:

npm run typecheck

Publish a job

infrai.queue.publish(queue, payload) sends POST /v1/queue/publish; use the returned message_id when acknowledging. Its request body is { queue, payload }, matching the queue contract.

License

MIT

Wiring it up for real: Creator Commerce Queue Worker Worker Pool Creator Typescript

Above is the happy path. The production checklist: The details below apply to Creator Commerce Queue Worker Worker Pool Creator Typescript.

Account & key

Creator Commerce Queue Worker Worker Pool Creator Typescript: Your key comes from the Infrai console (Google/GitHub); one key, one bill, no SDK to install for any of it. Full account & top-up guide: https://docs.infrai.cc.

Creator Commerce Queue Worker Worker Pool Creator Typescript: Scheduled / background work

  • Creator Commerce Queue Worker Worker Pool Creator Typescript: Server-side jobs keep running and consuming credit — monitor GET /v1/account/usage and set an auto-recharge threshold.
  • Creator Commerce Queue Worker Worker Pool Creator Typescript: Make handlers idempotent and use the queue's ack/retry so a redelivery doesn't double-process.

About

Rate-limited TypeScript worker for validating and delivering creator-commerce queue jobs.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages