0

I know about the 3 phase commit and SAGA pattern(doing transactions async in a distributed system using MQ). But it would involve using an MQ which makes me think of approach being taken mostly in SOA using ESB. Is there any way in which consistency can be achieved in between transactions in microservices using SpringCloud's inbuilt functionality.

Arnav Karforma
  • 112
  • 2
  • 12
  • Hi Arnav - Welcome to Stackoverflow. Just giving you a heads-up, questions here should be about programming and usually include code of some kind source code (See: [What topics can I ask about here?](https://stackoverflow.com/help/on-topic). Your question is a good one, but it's more about Design, along with maybe some Software Architecture, and it may fit better on; – Sean Mickey Sep 23 '19 at 09:18
  • Hi Sean- Yes I am really aware of that, but just expecting if any code snippet or link to such work using SpringCloud can be shared by someone who had the same issue figuring it out. – Arnav Karforma Sep 23 '19 at 09:24
  • Okay - Just thought it might fit better on: [Software Engineering](https://softwareengineering.stackexchange.com/). I'm not giving you a hard time - just trying to be helpful- – Sean Mickey Sep 23 '19 at 09:28
  • Perfect....will post it thr too.... Thanks sean – Arnav Karforma Sep 23 '19 at 09:33
  • 1
    Spring cloud doesn't have anything to deal with distributed transactions – spencergibb Sep 23 '19 at 10:44
  • Any idea what is the best approach.... – Arnav Karforma Sep 23 '19 at 11:17
  • 1
    I would suggest you to take a look here https://stackoverflow.com/questions/30213456/transactions-across-rest-microservices?rq=1 - TL DR there's no easy way to deal with distributed transactions often it's better to redesign your application – Martin Čuka Sep 23 '19 at 11:19
  • Could you use database or cache instead of MQ, and follow the SAGA pattern. – Rohan Sep 24 '19 at 05:02
  • @frabar But having one database for a service is the pattern and having a db shared between services is again anti-pattern and requires lot of locking mechanism to be handled from the code....... again giving rise to so many inconsistency issues....and if the transaction has to be completely exact suppose in a financial organization....would it be wise to rely on cache in a distributed system. – Arnav Karforma Sep 24 '19 at 10:19
  • @MartinČuka thanks for the share...It has few many really good approaches – Arnav Karforma Feb 20 '20 at 12:14

0 Answers0