Backbone Queues
FIFO message queues. Push from anywhere; process messages with a queue-triggered function:
drift.Backbone.Queue("orders").Push(map[string]any{"item": "widget", "qty": 3})A message body must be a JSON object. A bare string, number or array is rejected with 400 queue and body required. Queue names take alphanumerics plus ., _ and -, first character alphanumeric, up to 255 bytes. A push past the slice's queue_max_depth answers 429.
drift backbone queue push orders '{"item":"widget","qty":3}'
drift backbone queue peek orders # look without removing
drift backbone queue pop orders # take the next message
drift backbone queue len orders
drift backbone queue drop orders # delete the queue and every message in itQueue-triggered functions
// @atomic queue=orders binds a function to a queue; see Atomic triggers. A background poller pops the queue every 500 ms and invokes the function once per message.
The function receives the message's inner body object, not the {id, body, timestamp} envelope that queue peek and queue pop return. Read your own fields straight off the payload.
Retries and the dead-letter queue
An invocation that fails puts the message back with a _drift_retries counter. After three attempts the message moves to a queue named <queue>-dlq, created on the first dead letter. It is an ordinary queue, so inspect and drain it like any other:
drift backbone queue len orders-dlq
drift backbone queue peek orders-dlq
drift backbone queue pop orders-dlq