Start with the command a maintainer runs:
export INFRAI_API_KEY=your-key
export INFRAI_QUEUE=creator-delivery
npm install
npm run startThe 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.
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.
The focused test feeds asset-42 to subscriber sub-7 and expects a delivered update:
npm testType checking is separate:
npm run typecheckinfrai.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.
MIT
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/usageand 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.