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
- 200
- 400
- 404
- 409
- 500
The best-fit pending task was found and leased to this station.
Response Headers
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.
The Idempotency-Key header is missing (idempotency-key-required) or not 1-128 printable ASCII characters (idempotency-key-invalid) on a POST, or the request body could not be read or contains a NUL character (malformed-request-body), or the request body is malformed JSON, a required field is missing or empty, or a field value is invalid (e.g. a task type outside the TaskType enum).
No station is registered with this stationId.
No pending task of taskType exists that this station's capabilities satisfy right now — the pool has nothing to offer, not a transient error. Safe to retry later. The same Idempotency-Key reused with a different method, path or body is also a 409, problem type idempotency-key-reused.
An unexpected server-side failure (e.g. a repository or event-publisher error).