Goal
Choose and set the consumer for a queue.Prerequisites
- A queue
- For a Function consumer, a project with Functions deployed
Workflow
1
Open the queue and choose Consumer.
2
Pick Function, HTTPS push or Pull.
3
For a Function, pick the project and the function path.
4
Set batch size, batch wait, max retries, retry delay, concurrency and the dead-letter queue.
5
Save. Delivery starts with the next batch.
Function consumer
Pick the Function by its path in the dashboard, or pass function_path (and function_project_id if it lives in another project) in the consumer settings. Nothing in the Function’s code names the queue. The Function receives the same batch object an HTTPS push consumer gets and returns the same reply shape: ack and retry lists, or nothing to ack the whole batch. Any message not listed in retry is acked. Throwing retries the whole batch.Batch the Function receives
api/orders-consumer.ts
Consumer settings
- kind: function, https or pull.
- batch_size: 1 to 100 messages per batch.
- batch_wait_ms: how long to wait to fill a batch before sending a smaller one.
- max_retries: up to 100 retries after the first delivery, so 3 means up to 4 deliveries. After that the message goes to the dead-letter queue, or is deleted if there is none.
- retry_delay_seconds: how long a retried message waits before it is delivered again.
- max_concurrency: 0 for auto (scales with backlog), or a cap from 1 to 250 batches in flight.
- dead_letter: {mode: “new”} creates a dead-letter queue, {mode: “existing”, queue_id} uses one you have, {mode: “none”} deletes messages after max retries.
CLI
PUT /api/v1/queues/{queue}/consumer
Remove a consumer
DELETE /queues/{queue}/consumer removes it. Messages stay on the queue until a new consumer takes them or retention ends.Expected result
The queue state is Active and the out rate rises as the consumer acks messages.
Common failures
Related guides
HTTPS push consumers
StackShift POSTs each batch to your HTTPS endpoint, signed with Ed25519. Your reply says which messages to ack and which to retry.
Pull consumers
A worker anywhere pulls a batch over HTTP, leases the messages for a visibility timeout, then acks or retries each one by lease id.
Batching, retries and delays
How batch size and wait, retries, retry delays, concurrency and delivery guarantees work.