Node.js Queues vs Self-Hosted Workers: Handling Failed Jobs, DLQs and Idempotency
The article argues that retrying failed jobs safely with at-least-once queue delivery requires a dead-letter queue, acknowledging messages only after side effects succeed, and making consumers idempotent. It recounts an incident where increasing a webhook timeout caused a shipment event to be redelivered, so a partner received duplicate updates. The author recommends tracking explicit state transitions, distinguishing a received message from one whose update was applied, and replaying with a durable idempotency key such as shipment_id:event_version. Malformed payloads should go to a DLQ for operator review rather than being retried indefinitely. The worker is described as having three outcomes: ack on durable success, nack on transient failure, and DLQ after retries are exhausted.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in