Handling Compensation and Rollback in a Synchronous API-Based Saga Choreography for Microservices
In a microservices-based online order processing system using a saga choreography approach with synchronous API calls, a customer places an order involving multiple microservices: Order Service, Inventory Service, and Payment Service. After successful order placement, the Inventory Service decrements stock, and the Payment Service processes the payment. If a failure occurs during the compensation transaction to refund the payment amount after multiple retries, how can the system automatically roll back the inventory update without manual intervention or introducing a single point of failure, given that no queue mechanism is used, and all communication is synchronous?