Overview
Argos Mesh uses RabbitMQ as the message broker for asynchronous communication between microservices. The system implements a topic-based exchange pattern for flexible routing of events.Connection Configuration
Basic Connection Settings
RabbitMQ server hostnameDefault:
message_broker (Docker service name)Production: Use FQDN or IP addressAMQP protocol portDefault:
5672Authentication usernameDefault:
adminAuthentication passwordDefault:
admin123Number of messages to prefetch per consumerDefault:
1Purpose: Fair dispatch - each consumer processes one message at a timeApplication Properties Example
Queue and Exchange Architecture
Orders Service Queues
The Orders service publishes events related to sales and product management.Queue Name:
argos.sales.queueDurability: true (survives broker restart)Purpose: Receives sales transaction eventsExchange: shop.exchangeRouting Key: shop.event.soldQueue Name:
argos.products.mgmt.queueDurability: truePurpose: Receives product lifecycle events (created, updated, deleted)Exchange: shop.exchangeRouting Key: shop.event.product.# (wildcard)Configuration Code
orders/config/RabbitMQConfig.java
Sentinel Service Queues
The Sentinel service consumes events for monitoring and alert generation.Queue Name:
argos.sales.queueDurability: truePurpose: Monitors sales for rate limiting analysisExchange: shop.exchangeRouting Key: shop.event.soldQueue Name:
argos.alert.queueDurability: truePurpose: Publishes security alerts when suspicious activity is detectedExchange: alert.exchangeRouting Key: argos.alert.# (wildcard)Configuration Code
sentinel/config/RabbitMQConfig.java
Notify Service Queues
The Notify service consumes alert events for notification delivery.Queue Name:
argos.alert.queueDurability: truePurpose: Consumes alerts and sends notificationsExchange: alert.exchangeRouting Key: argos.alert.# (wildcard)Configuration Code
notify/config/RabbitMQConfig.java
Message Serialization
All services use Jackson JSON for message serialization with custom configuration:RabbitMQConfig.java
The
JavaTimeModule enables proper serialization of Java 8+ date/time types (LocalDateTime, Instant, etc.) without timestamps.Routing Patterns
Topic Exchange Routing
Argos Mesh uses Topic Exchanges for flexible message routing:| Routing Key | Pattern | Queue | Purpose |
|---|---|---|---|
shop.event.sold | Exact match | argos.sales.queue | Sales transactions |
shop.event.product.# | Wildcard | argos.products.mgmt.queue | Product events |
argos.alert.# | Wildcard | argos.alert.queue | Security alerts |
Wildcard Routing Explained
Wildcard Routing Explained
Hash (#) Wildcard: Matches zero or more wordsExamples:
shop.event.product.#matches:shop.event.product.createdshop.event.product.updatedshop.event.product.deleted
shop.event.*matches:shop.event.soldshop.event.created
- But NOT
shop.event.product.created
Queue Durability
Queue Durability
All queues are marked as durable (
true), which means:- Queues survive RabbitMQ broker restarts
- Messages are not lost on broker failure (when marked as persistent)
- Suitable for production environments
Prefetch Count
Prefetch Count
Setting
prefetch=1 ensures fair dispatch:- RabbitMQ won’t give more than one message to a worker at a time
- Prevents fast workers from being idle while slow workers are overloaded
- Messages are distributed evenly across consumers
Docker Configuration
RabbitMQ runs as a Docker container with the management plugin enabled:docker-compose.yml
Management UI
Access the RabbitMQ Management UI athttp://localhost:15672
Default Credentials:
- Username:
admin - Password:
admin123
Monitoring and Management
View Queues
Monitor queue depth, consumer count, and message rates in the Management UI
Check Bindings
Verify exchange-to-queue bindings and routing key patterns
Message Tracing
Enable tracing to debug message routing issues
Performance Metrics
Track message publish/delivery rates and memory usage
Troubleshooting
Connection Refused
Connection Refused
Symptoms: Services fail to start with connection errorsSolutions:
- Verify RabbitMQ container is running:
docker ps - Check health status:
docker logs message_broker - Ensure port 5672 is accessible
- Verify network connectivity between containers
Messages Not Being Consumed
Messages Not Being Consumed
Symptoms: Messages accumulate in queuesSolutions:
- Check consumer count in Management UI
- Verify listeners are registered: check application logs
- Ensure
@RabbitListenerannotations are present - Check for exceptions in consumer methods
Routing Issues
Routing Issues
Symptoms: Messages sent but not receivedSolutions:
- Verify routing key matches binding pattern
- Check exchange type (Topic vs Direct)
- Use Management UI to trace message flow
- Verify queue bindings are correct