RabbitMQ integration enables you to stream WhatsApp events to RabbitMQ queues for asynchronous processing, load balancing, and microservices architecture.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/EvolutionAPI/evolution-api/llms.txt
Use this file to discover all available pages before exploring further.
Configuration
Configure RabbitMQ connection and event routing through environment variables.Connection Settings
.env
The connection URI format is:
amqp://username:password@host:port/vhost- Default port: 5672
- Default vhost:
/ - For RabbitMQ with SSL, use
amqps://protocol
Global vs Instance Events
You can configure RabbitMQ to work in two modes:- Per-Instance Queues
- Global Queues
Each instance gets its own queues and exchange:Creates queues like:
.env
my_instance.messages.upsertmy_instance.qrcode.updatedmy_instance.connection.update
Exchange and Queue Setup
Evolution API automatically creates:Topic Exchange
A topic exchange with the configured name (default:
evolution)- Durable: Survives broker restarts
- Type: Topic (enables routing pattern matching)
Quorum Queues
Queues for each enabled event:
- Durable: Messages persist to disk
- Type: Quorum (replicated, highly available)
- Auto-delete: Disabled
Available Events
Configure which events are sent to RabbitMQ:- Instance Events
- Message Events
- Contact Events
- Chat & Group Events
- Other Events
.env
Per-Instance Configuration
Configure RabbitMQ events for a specific instance via API:Message Format
Messages published to RabbitMQ have the following JSON structure:Consuming Events
Here are examples of consuming events from RabbitMQ:Connection Resilience
Evolution API implements automatic reconnection with exponential backoff:- Initial delay: 5 seconds
- Maximum attempts: 10
- Exponential backoff: Delay doubles each attempt (up to 5 times)
- Heartbeat: 30 seconds to detect connection loss
During connection loss, Evolution API will queue events in memory and retry delivery. Monitor your RabbitMQ connection status in the logs.
Best Practices
Use Quorum Queues
Evolution API creates quorum queues by default for high availability and data safety. Ensure your RabbitMQ cluster has at least 3 nodes for optimal quorum queue performance.
Enable Acknowledgments
Always acknowledge messages after successful processing to prevent message loss:
Troubleshooting
Connection refused
Connection refused
- Verify RabbitMQ is running:
systemctl status rabbitmq-server - Check the connection URI in your
.envfile - Ensure firewall allows port 5672 (or your configured port)
- Verify credentials are correct
Messages not appearing in queues
Messages not appearing in queues
- Check that specific events are enabled in configuration
- Verify
RABBITMQ_ENABLED=true - Check Evolution API logs for RabbitMQ errors
- Ensure the instance is connected to WhatsApp
Consumer not receiving messages
Consumer not receiving messages
- Verify queue binding to exchange
- Check routing key matches event name
- Ensure consumer is acknowledging messages
- Check for messages in dead letter queue
High memory usage
High memory usage
- Check queue depth - consumers may be too slow
- Increase number of consumers
- Optimize message processing code
- Consider increasing
RABBITMQ_FRAME_MAXif messages are large