How to cancel a transaction between microservices?

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(){

    //do db update of Legal info for the user

   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

+5
4

/ JTA. JTA Java EE . Atomikos .

Dave Syer (Spring ). . , . Spring .

GitHub JTA . , , , JMS JDBC.

, JTA - 2- . , , - .

+2

.

() , legalService. Spring .

Cheers,

+2

, , , , , . , .

, , Apache Kafka ( , ). ? , , , , - .

, , , . Spring Boot + Netflix J2EE , , , .

Spring Boot + Netflix

0

, . , .

, , :

**

. , , , , ack , ack , / . , .

0

Source: https://habr.com/ru/post/1607004/


All Articles