Skip to main content
Live. This area is documented as current, user-reliable behavior.

Goal

Receive batches on your own endpoint, verify them, and ack or retry each message.

Prerequisites

  • A public HTTPS endpoint
  • An API key to fetch the verification key once

Workflow

1
Fetch the public key from GET /api/v1/jobs/verification-key and store it in your app’s config.
2
Set the queue’s consumer to HTTPS push with your URL.
3
In your endpoint, verify the signature over the raw body before parsing it.
4
Handle each message and reply with the ids to ack and to retry.

What StackShift sends

A POST with a JSON body and three headers. The timeout is 60 seconds.
  • X-StackShift-Timestamp: Unix seconds.
  • X-StackShift-Invocation: an id for this delivery.
  • X-StackShift-Signature: base64 Ed25519 signature over timestamp, a newline, the invocation id, a newline, then the raw body bytes.
Request body

How to reply

  • 2xx with {“ack”: […], “retry”: […]}: retried ids come back after delay_seconds (or the consumer’s retry delay). Every other message in the batch is acked, whether or not it is listed in ack.
  • 2xx with an empty body: every message in the batch is acked.
  • Non-2xx, or no answer within 60 seconds: the whole batch is retried.
Reply body

Verification key

The key is the same one Durable Jobs uses to sign job callbacks. Fetch it with your API key and keep the base64 public_key in your config. Never fetch a key from a URL the request gives you.
GET /api/v1/jobs/verification-key

Verify and reply with the SDK

Each SDK verifies the signature and timestamp and returns the parsed batch, or throws: QueuePushError in JavaScript, Python and Ruby, ErrQueuePushInvalid in Go, EventSignatureError in PHP. The error code is missing_signature, invalid_signature, expired or invalid_body. In JavaScript verifyPush is async. In Python, install the queues extra for verification: pip install “stackshift[queues]”. pushReply (push_reply in Python and Ruby, WriteQueuePushReply in Go) builds the reply body. To fetch the key from code, call client.queues.verificationKey() (verification_key in Python and Ruby, VerificationKey in Go and PHP).

Expected result

Batches arrive at your endpoint, acked messages leave the queue, and retried ones come back after their delay.

Common failures

  • Signature check fails: verify the raw bytes, not a re-serialised body, and check the server clock. Requests older than 300 seconds or more than 60 seconds in the future are rejected.
  • Every batch is retried: the endpoint answered non-2xx or took longer than 60 seconds.

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.

Batching, retries and delays

How batch size and wait, retries, retry delays, concurrency and delivery guarantees work.

Durable Jobs overview

Durable Jobs is the reliable execution engine for backend work on StackShift. Deploy the app. Offload the work.