Skip to main content

PULL-dispatch the best-fit pending task to this station

POST 

/stations/:stationId/task-claims

Implements this service's core dispatch rule: pull, not push. The station calls claimNext; the system — never the caller — selects which task to hand it. Among Pending tasks of taskType that this station's registered capabilities satisfy, the earliest-CPT task is selected and leased to stationId for a fixed duration (5 minutes by default). Assignment is at-most-once: a task with an active, unexpired lease cannot be claimed by anyone else, and this endpoint will simply skip it and try the next-best candidate. If the lease is not renewed or the task completed before it expires, the task automatically returns to the pool (see POST /task-lease-expirations) rather than being lost. This call is not idempotent in the way a PUT would be — every successful call claims a different task (or the same task again only after its prior lease was released); that's intended PULL semantics, not a bug.

Request​

Responses​

The best-fit pending task was found and leased to this station.

Response Headers
    Idempotency-Replayed

    Present, with the value true, ONLY when this answer is the stored replay of an earlier request that used the same Idempotency-Key (the handler did not run again). The first execution never carries it.