Async Batch Acceptance (/api/events/batch)
NoETL supports an async acceptance contract for worker batch event submission:
- Persist incoming worker events and a
batch.acceptedmarker. - Enqueue background processing for routing +
command.issued. - Return
202 Acceptedwith arequest_idimmediately.
This decouples client success from transient scheduler delays.
API contract
POST /api/events/batch
- Header:
Idempotency-Key(recommended for retry safety) - Response:
202 Accepted
Example response:
{
"status": "accepted",
"request_id": "574939110284985187",
"event_ids": [574939110284985188, 574939110284985189],
"commands_generated": 0,
"queue_depth": 4,
"duplicate": false,
"idempotency_key": "worker-1:574939110284985187:..."
}
Status tracking
Polling endpoint:
GET /api/events/batch/{request_id}/status
SSE endpoint:
GET /api/events/batch/{request_id}/stream
Possible states:
acceptedprocessingcompletedfailed
Failure classes
Error payloads include machine-readable code values:
ack_timeoutenqueue_errorqueue_unavailableworker_unavailableprocessing_timeoutprocessing_error
Configuration
Set these server env vars:
NOETL_BATCH_ACCEPT_ENQUEUE_TIMEOUT_SECONDS(default0.25)NOETL_BATCH_ACCEPT_QUEUE_MAXSIZE(default1024)NOETL_BATCH_ACCEPT_WORKERS(default1)NOETL_BATCH_PROCESSING_TIMEOUT_SECONDS(default15.0)NOETL_BATCH_STATUS_STREAM_POLL_SECONDS(default0.5)
Metrics
Exposed on /metrics:
noetl_batch_enqueue_latency_seconds_sumnoetl_batch_enqueue_latency_seconds_countnoetl_batch_ack_timeout_totalnoetl_batch_queue_depthnoetl_batch_first_worker_claim_latency_seconds_sumnoetl_batch_first_worker_claim_latency_seconds_count