Balasubramanian
Balasubramanian

Reputation: 728

Distributed transactions with RabbitMQ in spring boot application

Currently working on migrating a monolith app into micro services and I want to know how to achieve the distributed transaction in across application. Is there any examples for RabbitMQ handling distributed transaction?

please note that this is not a duplicate question. also i come with some example but i didn't find any implementation.

http://lifeinide.com/post/2017-12-29-spring-boot-rabbitmq-transactions/

Upvotes: 3

Views: 3735

Answers (1)

Shailendra
Shailendra

Reputation: 9102

Generally in microservices world, distributed transaction using 2PC protocol is discouraged as it slow and not scalable. Rather a pattern known as Saga is recommended. Failures are rolled-back using compensation steps or activities in reverse order. The whole idea is to let microservices do only local transactions and the transaction which span across microservices should be done in a scalable manner and using a strategy where failed transactions can be logically compensated locally. Saga pattern can use a messaging broker where events can be pushed to and listened to - this is where you can use RabbitMQ. An example project can be seen here and here.

Upvotes: 3

Related Questions