queue.drain
Advance a keyed queue: reap expired leases, reconcile running items against their target runs, then claim and launch up to max_claims new items honouring per-key and per-owner concurrency.
Reconcile and advance one queue: reap, reconcile, claim, launch.
Overview
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-queue |
| Version | 1.0 |
Input Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | string | Yes | — | — |
queue_name | string | Yes | — | — |
max_claims | integer | No | — | — |
max_active_per_owner | integer | No | — | — |
lease_seconds | integer | No | — | — |
reconcile_limit | integer | No | — | — |
dry_run | boolean | No | — | — |
Output Schema
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
reaped | integer | No | — | — |
reconciled | integer | No | — | — |
completed | integer | No | — | — |
failed | integer | No | — | — |
still_running | integer | No | — | — |
claimed | integer | No | — | — |
launched | integer | No | — | — |
launch_failures | integer | No | — | — |
items | json | No | — | — |
dry_run | boolean | No | — | — |
failure_reason | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_layer | string | No | — | — |
failed_step | string | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
reason | string | No | — | — |
States
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | execute | Accepted |
completed | No | Yes | Yes | — | Completed |
failed | No | Yes | No | — | Failed |
State Diagram
Transitions
| From | Action | To | Description |
|---|---|---|---|
pending | execute | completed | Run the queue operation |
* (any state) | fail | failed | Mark failed |
API Usage
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "queue.drain",
"initial_data": {
"organization_uuid": "value",
"queue_name": "value"
}
}