Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What technologies use to solve distributed transactions in real operating env(such as Netflix Inc.)?

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?

like image 999
henry-jo Avatar asked Dec 09 '25 18:12

henry-jo


1 Answers

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;
    }
like image 135
Maxim Fateev Avatar answered Dec 12 '25 12:12

Maxim Fateev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!