So I have two microservices, one that has a database and one that make RPC calls to the one that has the database. The one that makes the RPC calls (I called it gui-microservice) has two services, BookService and LoanService. These two services use rest templates to modify the resources in the other microservice (database-microservice).
I have a higher-level operation called checkOut(book) in the gui-microservice. This method will use the BookService's changeAvailabilityToOut(book) and LoanService's createLoan(book). I want to make this higher operation checkOut(book) atomic and roll back if either checkOut(book) or changeAvailabilityToOut(book) fails, kind of like a @Transactional call, but instead of interacting with a database, you are interacting with a rest microservice.
The question is that is there any tools in the Spring library that will help me do that. Is there anything besides architectural changes at all?
What I have tried:
I tried reading up and people just say to change my architecture, but the code is already quite big to do this comfortably. I am trying to research on the @Transactional annotation but nothing turned up.