A production-inspired event-driven microservices project built with RabbitMQ, Docker Compose, and Python that demonstrates asynchronous communication, service decoupling, fault tolerance, and scalable messaging architecture.
Modern applications are composed of multiple independent microservices. Instead of communicating directly with each other, they exchange events through a message broker such as RabbitMQ.
This project simulates a real-world event-driven architecture where multiple services independently consume events produced by a central producer.
Currently, the project consists of:
- Producer Service
- RabbitMQ Message Broker
- Email Consumer
- Analytics Consumer
- Notification Consumer
Each service runs in its own Docker container and communicates asynchronously through RabbitMQ.
In traditional systems, services often communicate directly.
Order Service
│
├── Email Service
├── Analytics Service
├── Notification Service
├── Billing Service
└── Inventory Service
As the application grows, the producer becomes tightly coupled with every service.
Problems include:
- High service dependency
- Difficult scalability
- Complex deployments
- Poor fault tolerance
- Hard to introduce new services
Instead of communicating directly, services exchange events through RabbitMQ.
Producer
│
▼
RabbitMQ Exchange
┌──────────┼──────────┐
▼ ▼ ▼
Email Queue Analytics Queue Notification Queue
▼ ▼ ▼
Email Service Analytics Service Notification Service
Each microservice is completely independent.
New services can be added without modifying existing consumers.
- Asynchronous Event Processing
- Event-Driven Architecture
- RabbitMQ Direct Exchange
- Multiple Independent Consumers
- Durable Queues
- Persistent Messages
- Automatic RabbitMQ Connection Retry
- Automatic Reconnection on Failure
- Dockerized Microservices
- Health Checks
- Restart Policies
- Environment Variable Configuration
- Fault-Tolerant Messaging
- Containerized Deployment
- Python 3.12
- RabbitMQ
- Docker
- Docker Compose
- Pika (RabbitMQ Python Client)
Fault-Tolerant-RabbitMQ-Event-Processor/
├── producer/
│ ├── producer.py
│ ├── Dockerfile
│ └── requirements.txt
│
├── consumers/
│ ├── email/
│ ├── analytics/
│ └── notification/
│
├── docker-compose.yml
├── README.md
└── docs/
Every few seconds the Producer generates an order event.
The producer publishes three different events:
- Email Event
- Analytics Event
- Notification Event
RabbitMQ routes each event to the appropriate queue using routing keys.
Each consumer listens only to its assigned queue.
Producer
↓
RabbitMQ Direct Exchange
↓
routing=email → email_queue → Email Consumer
↓
routing=analytics → analytics_queue → Analytics Consumer
↓
routing=notification → notification_queue → Notification Consumer
This architecture keeps services loosely coupled and independently scalable.
git clone https://github.com/saiganesh74/Fault-Tolerant-RabbitMQ-Event-Processor.git
cd Fault-Tolerant-RabbitMQ-Event-Processordocker compose up --build -ddocker psYou should see:
- rabbitmq
- producer
- consumer
- analytics
- notification
docker logs -f producerdocker logs -f consumerdocker logs -f analyticsdocker logs -f notificationdocker compose downRabbitMQ Management UI is available at
http://localhost:15672
Default credentials:
Username : guest
Password : guest
Producer
│
├── Email Event ─────────► Email Queue ─────────► Email Consumer
│
├── Analytics Event ─────► Analytics Queue ─────► Analytics Consumer
│
└── Notification Event ──► Notification Queue ──► Notification Consumer
The project automatically handles failures by:
- Retrying RabbitMQ connection until available
- Reconnecting after broker restart
- Durable queues survive RabbitMQ restarts
- Persistent messages prevent data loss
- Docker restart policies automatically restart containers
The project will continue evolving into a production-grade messaging platform.
Upcoming improvements include:
- Fanout Exchange
- Topic Exchange
- Dead Letter Queue (DLQ)
- Retry Queues
- Delayed Messages
- Message TTL
- Priority Queues
- Publisher Confirms
- Consumer Prefetch
- Prometheus
- Grafana
- RabbitMQ Exporter
- Queue Monitoring
- Consumer Metrics
- Alerting
- Chaos Engineering
- Network Failure Simulation
- Container Failure Testing
- High Availability RabbitMQ Cluster
- TLS Encryption
- RabbitMQ Authentication
- Authorization
- Secrets Management
- Kubernetes
- Helm Charts
- Horizontal Pod Autoscaling
- GitHub Actions CI/CD
- ArgoCD GitOps
This project demonstrates practical knowledge of:
- Event-Driven Architecture
- RabbitMQ
- Docker
- Docker Compose
- Message Routing
- Microservices
- Fault Tolerance
- Container Networking
- Durable Messaging
- Asynchronous Communication
- Production-Oriented System Design
Contributions, feature requests, and improvements are welcome.
Feel free to fork the repository and submit a pull request.