I'm converting the Monolith spring project to MSA environment. But, I faced the issue of distributed transaction.
I know there are two ways to solve distributed transaction: 2pc commit and saga.
I tried to solve it with Saga pattern of Axon framework.
However, the Saga feature of the Axon Framework, which focuses on DDD, EventSourcing, and CQRS, did not appear to be very good. (I only need Saga pattern because it is impossible to apply DDD concept right now.)
In many companies that have well-established MSA environments(such as Netflix), what technology (not abstract technology) is being used to solve distributed transactions?
temporal.io open source platform is used by many companies (including Netflix and Coinbase) to guarantee the execution of business processes as well as appropriate compensations. SAGA is also directly supported.
Here is the snippet from the SAGA sample:
Saga saga = new Saga(sagaOptions);
try {
String carReservationID = activities.reserveCar(name);
saga.addCompensation(activities::cancelCar, carReservationID, name);
String hotelReservationID = activities.bookHotel(name);
saga.addCompensation(activities::cancelHotel, hotelReservationID, name);
String flightReservationID = activities.bookFlight(name);
saga.addCompensation(activities::cancelFlight, flightReservationID, name);
} catch (ActivityFailure e) {
saga.compensate();
throw e;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With