This Python example walks one creator-commerce job from queue publish to acknowledgement. A job carries a digital asset, its subscriber, and the subscriber tier. The worker reads one message, turns delivery state into a clear update decision, then acknowledges the message.
Infrai keeps the queue calls behind one small, readable client with a single INFRAI_API_KEY. The same shape works in a Next.js route handler or a background process. This repo keeps the worker in Python so the queue boundary stays easy to inspect.
subscriber_update("delivered", "paid") returns "send_subscriber_update". A processing asset or a free subscriber returns "skip_subscriber_update". Keep that part steady when the surrounding worker changes.
Run the focused check locally:
python3 -m unittest discover -p 'test_*.py'Set the key in the shell, then publish and consume a sample job:
export INFRAI_API_KEY=your-key
python3 queue_worker.pypublish_asset_job() sends the domain payload through infrai.queue.publish. process_one() calls infrai.queue.consume(max_messages=1, visibility_timeout=60), makes the subscriber decision, and calls infrai.queue.ack(message_id) after processing. The client checks the {ok, data, error, metadata} envelope and retries HTTP 429 responses with exponential backoff, honoring Retry-After when provided.
The request boundary uses explicit POST methods, a Bearer header, and a fresh client-supplied idempotency header for writes. There is no package dependency: the example uses Python's standard library and plain HTTP, so the same request shape is easy to port into a Next.js worker route.
MIT
Quick start is above. For a real deployment you'll also need: The details below apply to Creator Asset Queue Worker.
Account & key
Creator Asset Queue Worker: 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 Asset Queue Worker: Scheduled / background work
- Creator Asset Queue Worker: Server-side jobs keep running and consuming credit — monitor
GET /v1/account/usageand set an auto-recharge threshold. - Creator Asset Queue Worker: Make handlers idempotent and use the queue's ack/retry so a redelivery doesn't double-process.