- Local RabbitMQ installation
- rabbitmq-delayed-message-exchange plugin enabled. Refer to this guide for installation and plugin activation.
- Node.js
This repository covers the following key points:
- Message Publishing: Utilize a message publisher to send a high volume of messages to the primary queue.
- Consumer Implementation: Implement a consumer to receive and process the incoming messages.
- Server Mocking: Create a server (
server.js
) simulating an external API, running on port 8000, to handle message processing. - Watcher Implementation: Develop a watcher to monitor both the dead letter queue and server uptime, taking appropriate actions.
- Retry Mechanism: Messages failing processing will be requeued with incremental delays to avoid overloading the processing system.
- Dead Letter Queue: Implement a dead letter queue to store messages that consistently fail processing, preventing indefinite retries.
- Scheduler Integration: A scheduler monitors the dead letter queue's size and transfers messages back to the primary queue when conditions normalize.
- Consumer Prefetch: Configure the consumer with a prefetch setting to determine the number of messages a consumer can handle concurrently.
- Durable Flags: Set the durable flag to
true
for both queues and exchanges, ensuring message persistence even during RabbitMQ service restarts.
The flow of the Dead Letter Queue is visually represented in the following diagram:
This diagram illustrates the entire process, from message publishing to dead letter queue handling and eventual message reprocessing.