Reputation: 75
I have read Udi's article Life without distributed transactions.
Does MassTransit support distributed transactions? (to avoid duplication problem on the MassTransit, not manually checking by code)
Upvotes: 1
Views: 1985
Reputation: 33268
MassTransit has a feature called Courier, which implements distributed transactions using an execute/compensate style routing slip approach. You can see a code sample on GitHub: https://github.com/MassTransit/Sample-Booking
The routing slip breaks a transaction into a set of activities that are performed atomically, in order, with compensation information logged in the routing slip. If an activity faults, the previously completed activities are compensated so that partial transactions are not left open.
This is the basis for doing distributed transactions, and has been used in several large scale distributed transaction processing applications in production today.
Another good example of Courier usage: https://github.com/phatboyg/Demo-Registration
Upvotes: 5
Reputation: 753
Documentation was added to demonstrate how this might be done with MT3:
But your still going to need to monitor in production to see what happens in the event of database failures and RabbitMQ broker disconnects/reconnects to ensure the behavior is as expected.
Or, perhaps you can also look into Using Sagas in MT instead which are designed to manage the complexity of a distributed transaction without locking and immediate consistency. :)
Upvotes: 0