Example for handling money transfer transaction between two microservices using axon framework

I have two microservices called mircroservice 1 and microservice 2.
Microservice 1 is withdrawing money from one bank account.
Microservice 2 is crediting the withdrawn money from microservice one.

So how to handle the transaction between those two microservices using axon framework?
Rollback mechanism has to be handled.

Hi @Rocking,

When withdrawing money from one bank account and adding the amount to another account you cannot rollback a transaction. Bank A can not hold a lock on the database of Bank B. What you need to do in this case is to do a compensating action when something goes wrong. In this case when something goes wrong when adding the amount, withdraw action should be undone. I hope this helps

1 Like