ProductFlow
Overview
ProductFlow is a .NET microservice demo that demonstrates reliable asynchronous order processing using RabbitMQ, the outbox pattern, and an idempotent consumer.
It showcases how to safely persist and publish domain events while handling failures and duplicate message delivery.
Architecture • OrdersService (API + Outbox + Dispatcher) • NotificationService (Consumer + Idempotency) • RabbitMQ (message broker) • PostgreSQL (data storage)
Flow
- Client sends POST /orders
- Order and outbox event are saved in the same transaction
- OutboxDispatcher publishes events to RabbitMQ
- NotificationService consumes the event
- Idempotency check prevents duplicate processing
- Notification is stored
Key Concepts
Outbox Pattern Ensures events are not lost between database writes and message publishing by storing events in the database and publishing them asynchronously.
Idempotent Consumer Prevents duplicate processing by tracking processed event IDs and skipping repeats.
Eventual Consistency The system allows a delay between order creation and downstream processing to ensure reliability.
Failure Behavior • Outbox events are retried if publishing fails • Duplicate messages are ignored via idempotency checks • Failed consumer messages are currently rejected (no DLQ yet)
Tech Stack • .NET • RabbitMQ • PostgreSQL • EF Core • Docker
Running the Project
docker-compose up
Then:
dotnet run --project OrdersService dotnet run --project NotificationService
Test: POST /orders
Current Limitations • No dead-letter queue • No structured logging • No retry/backoff strategy • No UI