drift Docs
Start
What is Drift?
The tour, if you are new here.
Use cases
Whether Drift does your thing.
Getting started
Nothing to deployed, in one command.
Architecture
How a slice is put together.
What it costs
The free grant, four 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.
Troubleshooting
Error codes
What went wrong, and what to do about it.
Legal
Acceptable use
What a slice may not be used for.
Data processing
The DPA, and every sub-processor.

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 queue's depth answers 429; depths are set in the slice's shape.

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

Naming a function queue:orders in the Driftfile binds it to that 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