OiO.lk Blog java Microservices – saga choreography
java

Microservices – saga choreography


I am usure how to maintain consistency in a microservices architecture system using choreography for transaction management.

Take this simple architecture :

For the Operation #1 and #2 I can use the Outbox pattern to ensure the changes in the database result in a message being published on the Queue.
Or simply One Phase commit where I nest the database transaction inside the boundaries of the Messaging transaction :

  • Start messaging transaction
  • Start database transaction
  • Receive message
  • Update database
  • Commit database transaction
  • Commit messaging transaction

But what about the operation #3, #4 and #5 where I have to :

  • read the message
  • write to the database
  • send a response message to another queue

What can I do to make sure that, after I committed the DB transaction, I also post a message in the response queue ? I want to avoid the possibility that the DB transaction in PaymentsDB is successful but no message is sent on the response queue.



You need to sign in to view this answers

Exit mobile version