RabbitMQ Dead Letter Queue
Introduction
To prevent data loss of RabbitMQ queue, Insights product will handle this with help of RabbitMQ dead letter queue.
Pre-Requisite:
- Dead letter exchanges (DLXs) are normal exchanges, Insights planning maintain one queue for whole application.
- DLX attached to normal queue (Health and Data) at the time declaration of queue, this means that user has to delete all their queue before activating DLX in their environment.
- Insights Version 8.1+ support this functionality
- If you already have agent registered, do the following steps in sequence
- Stop All Agent
- Consume all data from queue
- Stop Engine, Daemon Agent and platform service
- Delete all existing queue
- Activate DLX mention in below section and start all services
Activation:
- Activate it in all configuration files mentioned below
In server-config for PaltformService and PlatfromEngine
- Enable enableDeadLetterExchange in messageQueue section of server-config.json
"messageQueue": {
"host": "localhost",
"port": 5672,
"user": "",
"password": "",
"prefetchCount": 5,
"enableDeadLetterExchange":false
},
In Deamon Agent and In Agent
- Enable enableDeadLetterExchange in mqConfig section of Config.json
In PlatformInsightsWebHook
- Enable app.enableDeadLetterExchange in webhook_subscriber.properties
- Restart all services after property changes
How to use it
- One user activates DLX, application will create "iRecover" Exchange name with type "fanout" in RabbitMq
- INSIGHTS_RECOVER_QUEUE will be created.
- Declaration of DLX in RabbitMQ
Queue
Exchange
Agent/Webhook Queue
- When any exception occurs during processing of messages then Insights application Reject that message and it will send to DLX Queue
- Message in INSIGHTS_RECOVER_QUEUE of DLX contain in following format
Upgrading from older version of Insights
- Stop All Agent
- Consume all data from queue
- Stop Engine, Daemon Agent and platform service
- Delete all existing queue
- Activate DLX mention in above section
- start all services
Deactivating DLX
- Stop All Agent
- Consume all data from queue
- Stop Engine, Daemon Agent and platform service
- Delete all existing queue
- Deactivate DLX by disabling enableDeadLetterExchange to false in server-config.json, Agnets config.json and daemon agent config.json
- Start all services