I need resolve atomic operations in my microservice based application based on spring boot. You can imagine 2 microservices as you can see on picture.
One service is using for saving user permissions and credentials as identity provider and another one as user account used in application to pair with orders, contacts, addresses and so on.
When user created new account I need create user for business purposes and user identity for authorization. Both operations should be executed as one atomic operation. It means if one failed, must bot failed and rollback. Cannot will be saved user credentials but without business user object. Can you tell me what is the best way to solve this or what steps should look like?
My first idea was call with RestTemplate of Feign one service from another, but I have no idea how to rollback operation if second failed. Thank you in advice.