Skip to main content

Re-attempt allocation for backordered lines, then release

POST 

/orders/:id/allocation-retries

The RetryAllocation use case. Re-attempts allocation for the order's Backordered lines and ONLY those lines — it is the single sanctioned route from Backordered back to Allocated, and it is what unblocks a ship-complete order held back by BR3. UNLIKE the implicit allocation attempt folded into POST /orders, this is an explicit, on-purpose operator/recovery action: a hard (non-409) failure here fails the call with 503 rather than being swallowed — invoking this endpoint IS asking for allocation right now.

A line still short of stock stays Backordered (no error). The same fail-closed rule as intake's implicit allocation applies to any non-409 failure. An order with no backordered line at all is rejected with 409: retrying an order that is not backordered is a caller mistake, not a no-op.

On success, this ALSO attempts release in the same call — the same allocation-then-release flow POST /orders uses — announced via the enriched OrderAllocated / OrderPartiallyAllocated Kafka events rather than any synchronous call to a Supplier.

Idempotent through the Idempotency-Key header (REST guideline, ADR 0023/0048): a retry with the same key, method, path and body replays the stored answer with Idempotency-Replayed: true and allocates nothing again, so the key row, the order change and the outbox rows commit together. A refusal that depends on the order's state or on a concurrent writer (no-backordered-lines, concurrent-modification) and every 5xx are not stored: the key is released and a retry under the same key executes again.

Request​

Responses​

The order after the retry-then-release pass.

Response Headers
    Idempotency-Replayed

    Present, with the value true, ONLY when this response is a replay of the stored answer for the request's Idempotency-Key (the handler did not run again). The first execution of a key never carries it.