Goal
Create a queue that is ready to receive and deliver messages.Prerequisites
- A StackShift project
- An API key for the CLI or API
Workflow
1
Open Queues and choose New queue.
2
Pick the project and a name. Names are unique within the project.
3
Set retention (1 hour to 14 days, default 4 days) and an optional default delay.
4
Choose which content types the queue accepts: json, text and bytes.
5
Choose a consumer: Function, HTTPS push or pull. You can add or change it later.
6
Choose a dead-letter queue: make a new one, use an existing one, or none.
7
Create the queue.
Naming a queue in calls
Anywhere a call takes a queue, pass its name, for example orders. If you have queues with that name in more than one project, the API answers 409 queue_name_ambiguous; then pass the queue id or <project_id>:<name>, for example p_789:orders (the CLI also takes —project).CLI
Create and list
API
- The response is the queue (201) with its id, state, backlog and consumer.
- dead_letter.mode is new (StackShift creates a dead-letter queue for you), existing (pass queue_id) or none (messages that run out of retries are deleted).
- Leave out consumer to create the queue first and add one later with PUT /queues/{queue}/consumer.
- PATCH /queues/{queue} changes retention, default delay and accepted types. Shortening retention deletes older messages straight away.
- DELETE /queues/{queue} with {“confirm_name”: “orders”} deletes the queue. In the dashboard you type the name to confirm; in the CLI, stackshift queues delete checkout-api:orders —confirm orders.
POST /api/v1/queues
Expected result
The queue shows in the Queues list as Active, or No consumer if you have not chosen one yet.
Common failures
Related guides
Send messages
Send one message or a batch of up to 100 from the SDKs, the CLI or the API, as JSON, text or bytes, with an optional delay and idempotency key.
Consumers and Function consumers
Each queue has one consumer: a Function, an HTTPS endpoint, or pull. Function consumers are chosen in the dashboard or API, not in code.
Dead letters, redrive, pause and purge
Find messages that ran out of retries, group them by error, send them back once fixed, pause delivery, or purge a queue.