☄️ Master the Modular Monolith Architecture: https://bit.ly/3SXlzSt
📌 Accelerate your Clean Architecture skills: https://bit.ly/3PupkOJ
🚀 Support me on Patreon to access the source code: https://www.patreon.com/milanjovanovic
A well-known pattern for solving distributed transactions is the Saga pattern. The Saga is a sequence of local transactions, where each local transaction updates the Saga state and publishes a message triggering the next step in the Saga. In this video, I'll show you how to create an orchestrated Saga using the Rebus library with RabbitMQ for message transport.
Implementing The Saga Pattern With Rebus And RabbitMQ
https://www.milanjovanovic.tech/blog/implementing-the-saga-pattern-with-rebus-and-rabbitmq
Join my weekly .NET newsletter:
https://www.milanjovanovic.tech
Read my Blog here:
https://www.milanjovanovic.tech/blog
Subscribe for more:
https://www.youtube.com/@MilanJovanovicTech
Chapters
0:00 What is the Saga Pattern?
0:41 Installing Rebus and the required libraries
1:22 Adding the RabbitMQ Docker image
2:05 Configuring Rebus and RabbitMQ
4:18 Creating the Saga and ISagaData classes
6:10 Defining the Event messages
7:27 Configuring the Saga - IAmInitiatedBy, IHandleMessages
8:03 Implementing the CorrelateMessages method
8:39 Handling the first step in the Saga
9:46 Adding the handler for the SendOrderConfirmationEmail command
11:14 Handling the next step in the Saga and updating the Data
12:14 Adding the handler for the SendOrderPaymentRequest command
13:19 Completing the Saga with MarkAsComplete
14:19 Subscribing to messages from RabbitMQ
15:22 Publishing the first message to start the Saga
15:59 Examining the complete Saga flow