How to Build a Resilient Architecture with RabbitMQ, C#, Entity Framework, and the Transactional Outbox Pattern
In the first step, you will create two microservices. Each microservice has its own database. They use events to publish changes to a RabbitMQ event bus. (You can skip this part if you already implemented it in my last article). Next, you will see how messages get lost e.g. when the message bus is down.
In the second part, you apply the transactional outbox pattern and see how it prevents losing messages.
In the last step, you add publisher and subscriber acknowledgments and duplicate/out-of-order message handling.
See my previous article for how to create the Microservices and configure RabbitMQ.
This will give you the following components and workflow:
Now both microservices and the RabbitMQ container “some-rabbit” should be running. Use the REST API of the User service to create and modify users and make sure everything is working. The User service should be sending events to the event bus and the Post service handles them. And the users in the user database are in sync with the users in the post database.
#microservices #rabbitmq #aspnetcore #software-architecture