queue.claim-next ​
Lease the next eligible queue item in FIFO order. Skips partition keys that already have an active item and owners at their concurrency cap. Returns claimed=false when nothing is eligible.
Lease the next eligible item for a queue, respecting per-key exclusivity.
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 | — | — |
lease_seconds | integer | No | — | — |
max_active_per_owner | integer | No | — | — |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
claimed | boolean | No | — | — |
item | json | No | — | — |
item_uuid | string | No | — | — |
claim_token | string | No | — | — |
target | json | 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.claim-next",
"initial_data": {
"organization_uuid": "value",
"queue_name": "value"
}
}