drift Docs
Start
What is Drift?
The tour, if you are new here.
Why Drift?
The case for a smaller cloud.
Getting started
Nothing to deployed, in one command.
Architecture
How a slice is put together.
What it costs
The free grant, five unit prices, two rules.
Build
Canvas
Static sites, same origin as your API.
Tools
Operate
Auth
Accounts, tokens and scopes.
Security
Boundaries, sandboxing and hardening.

Backbone Queues

FIFO message queues. Push from anywhere; process messages with a queue-triggered function:

Go
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.

Shell
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 it

Queue-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:

Shell
drift backbone queue len  orders-dlq
drift backbone queue peek orders-dlq
drift backbone queue pop  orders-dlq