ezgh queues subscriptions create <queue> (--url <url> [--batch-size n] [--timeout t] | --workflow-app <app> --workflow <w> [--mode start|resume] [--correlation-attribute a]) [--max-concurrency n] [--paused] [flags]Subscribe a queue (at most one subscription each) to an HTTPS endpoint (--url) or to an EZGH Workflows workflow (--workflow-app and --workflow).
With --url, Queues POSTs batches of its messages there, signed with EZGH-Signature. A 2xx answer acknowledges the batch, or all but the messages a {“failed”: […]} body names; anything else retries with backoff, and a message moves to the queue’s dead-letter queue after its --max-receives. The signing secret is printed once, alone on stdout; notes go to stderr.
With --workflow-app (an app’s name, slug or ID, in the same project) and --workflow, each message starts a run of that workflow, one message per call (the batch size is 1), with the message as the run’s input; up to --max-concurrency starts are in flight, and a FIFO queue waits for each start before the group’s next message. It needs workflows.runs.start on the workflow as well as queues.subscriptions.create, and has no signing secret.
With --mode resume and --correlation-attribute <a>, each message instead resumes the app’s runs waiting for a message (step.waitForMessage) on the queue with the key that is the message’s attribute <a>: every run waiting on it at that moment. A message without the attribute, or that no run is waiting for yet, is retried with backoff, then moved to the dead-letter queue. It needs workflows.runs.resume on the workflow.
Pull receives still work alongside either.
Part of ezgh queues subscriptions.
Examples
ezgh queues subscriptions create orders --url https://hooks.example.com/orders --max-concurrency 20
ezgh queues subscriptions create payments --workflow-app web --workflow chargeCustomer
ezgh queues subscriptions create approvals --workflow-app web --workflow refund --mode resume --correlation-attribute orderIdFlags
| Flag | Type | Default | Description |
|---|---|---|---|
--batch-size |
int | messages per delivery, 1 to 10 (default 10) | |
--correlation-attribute |
string | with --mode resume: the message attribute whose value is the waiting runs’ key |
|
--max-concurrency |
int | deliveries in flight at once, 1 to 100 (default 10) | |
--mode |
string | start |
with a workflow target: start (each message starts a run) or resume (each message resumes the runs waiting for it) |
--paused |
boolean | create it paused: nothing is delivered until it’s resumed | |
--timeout |
string | how long a delivery may take, 1s to 60s (default 30s) | |
--url |
string | the HTTPS endpoint deliveries are POSTed to | |
--workflow |
string | the workflow each message starts a run of, or whose waiting runs it resumes (with --workflow-app) |
|
--workflow-app |
string | the EZGH Workflows app (name, slug or ID) whose workflow each message starts |
This command also takes the global flags.