we have an architecture microservicewhere for the most part each is microserviceindependent. But for some inherited reasons, a situation arises when we need to call another microservicefrom another.
for example: the following method is part Legal Service
@Autowired
public ServiceManager UserServiceManager;
public void updateUserLegalData(){
userServiveManager.setAcceptedLegal(true);
}
There are two db transactions. one updates the legalService db and the other updates the UserService db. NOTE. userService is microservicerunning on a separate virtual machine.
we see situations in which the db legal service is updated, but the call to the userService function fails ( Internal server error). therefore, this leaves the application in an inconsistent state. How can we fix this in the recommended way?
thanks