I have 5 instances of account microservice which transfers the money from account A to account B and then updates the data in the Postgres database. My problem is
A user sent five requests to the account service and all of my microservices are working in parallel each request went to all 5 services way but now the user doesn't have enough balance in the account and I am already checking if the user is having enough balance or not.
but after 2 requests user doesn't have enough balance so I am in confusion how to check this and implement data consistency first before the request goes to another instance of the same microservice.
I would love to have suggestions and other approaches also