Menu

Dead-letter queue with CDK: alarms and automatic redrive
📰

Dead-letter queue with CDK: alarms and automatic redrive

DEV Community: aws·Sascha Mirow-Stanitzok·about 13 hours ago
#KlPOpdUd
#devtoaws#devto#dev#queue#lambda
Reading 0:00
15s threshold

Setting up a dead-letter queue with CDK takes three lines: deadLetterQueue: { queue, maxReceiveCount } , done. The real work starts afterwards. Who notices when the DLQ fills up? What happens to a message that will never work? And who moves the others back once the billing API is running again after an hour-long outage? In many projects the honest answer is: somebody, at some point, by hand.

In my first article on the SQS dead-letter queue I built this with the Serverless Framework: queue, DLQ, alarm and a redrive script. Today we go one step further. You wrap everything in a reusable AWS CDK construct, separate transient from permanent errors and let the DLQ move back automatically on a schedule. To keep this from turning into an endless loop, the most important ingredient comes before the schedule: clean error classification in the consumer.

In short

A custom CDK construct bundles queue, DLQ, alarms and a scheduled redrive via EventBridge Scheduler, so every new queue gets the same safety nets.…

Continue reading — create a free account

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