Using raw `RabbitMQ.Client` or `Azure.Messaging.ServiceBus` is difficult. You have to handle retries, serialization, and topology yourself. MassTransit handles this for you.
Saga Pattern
MassTransit has first-class support for Sagas (Long running processes) using State Machines.
stateDiagram-v2
[*] --> Submitted
Submitted --> Validated : Order Validated
Validated --> PaymentPending : Payment Requested
PaymentPending --> Paid : Payment Received
Paid --> Shipped : Shipping Confirmed
PaymentPending --> Cancelled : Payment Failed
This state machine is defined in C# using a fluent syntax (`Currently(Submitted).When(OrderValidated)…`) and persisted to SQL/Redis automatically.
Discover more from C4: Container, Code, Cloud & Context
Subscribe to get the latest posts sent to your email.