Menu

Failed jobs in Node.js: dead-letter handling with BullMQ
πŸ“°

Failed jobs in Node.js: dead-letter handling with BullMQ

DEV Community: redisΒ·Sandro DezerioΒ·3 days ago
#2F7BMIH3
#devtoredis#devto#dev#queue#failed
Reading 0:00
15s threshold

Part 7 of 10: Reliable background jobs in Node.js, from zero .

By Sandro Dezerio , senior full-stack engineer.

The sign-up example is the one from Part 1 , Part 2 , Part 3 , Part 4 , Part 5 , and Part 6 . The numbers in this post come from running the code in it against a real Redis, with a fake email provider. Tested with Node 22, BullMQ 6.5.3, ioredis 6.0.0, and Redis 7.

Part 6 left a loose end. When a job fails on its last attempt, it does not disappear. It stays in the failed set, the worker moves on to the next job, and nobody is told. The first alarm is a customer who never got a welcome email. This post gives failed jobs a place to go, separates the failures that a retry can fix from the ones it cannot, and raises an alert when jobs pile up, before a customer notices.

Where a failed job goes

Imagine a store with 20 new sign-ups. Two people typed their address wrong, with a comma instead of a dot, and the email provider rejects those addresses for good.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.