Triggers
An HTTP route is one way to reach a function. A queue and a schedule are the other two, and neither needs a caller: the slice invokes the function on your behalf.
Queue-triggered functions
A function doesn't have to be called over HTTP. Give it method: queue and name the queue as its route and the slice polls a Backbone queue on your behalf:
atomic:
functions:
- route: orders
method: queue
handler: handle_orderdef handle_order(body, req):
# body is the message that was pushed onto the "orders" queue
drift.backbone.nosql.collection("orders").insert(body)
return 200, "OK", {"stored": True}A queue handler takes the body shape, (body, req), and the popped message is the body. It returns the same three (or four, in Go) values an HTTP handler does.
| Behaviour | Value |
|---|---|
| Poll interval | 500 ms |
| Retries | 3. A failed message is requeued with its retry count; once exhausted it moves to <queue>-dlq. |
| What counts as a failure | The invocation errored, or the handler returned a 5xx status. |
| Reachability | Registered under a synthetic queue method that no HTTP request can match, so a queue handler has no URL. |
| Booking | The slice books it under the name you declared — queue:orders — exactly like an HTTP function. |
None of those defaults are configurable. Since any HTTP function has a public URL, a post:… function is your webhook receiver. Point Stripe, GitHub or your provider straight at it.
Scheduled functions
A schedule is not an identity — it is something a function also does. Give any function a cron: and it runs on that schedule in addition to its own trigger. Same code, two ways in:
atomic:
functions:
- route: nightly-rollup
method: post
handler: PostNightlyRollup
cron: "0 2 * * *" # 02:00 daily, and still callable over HTTP
- route: hourly-cleanup
method: post
handler: PostHourlyCleanup
cron: "0 * * * *"Standard 5-field POSIX cron: minute hour day-of-month month day-of-week. Seconds and the 6-field quartz format are not supported. The schedule registers as part of the deploy, with no post-deploy step, and the deploy is refused if it would push the slice past its scheduled-job allowance.
Each fire delivers a small JSON body, so a scheduled handler takes the body shape:
{ "fired_at": "<RFC 3339 timestamp>", "schedule": "0 2 * * *" }Anything else the handler needs comes from secrets or Backbone.