In a long transaction where multiple sub transactions happen in different services, if one transaction fails, works of other services should be rolled back as well
- Orchestration: (SYNCHRONOUS) A central service acting as an orchestrator calls other services in the due order and if there happens to be a failure, it'll compensate by calling compensating actions on other services it called before. This way, one step must be successful before continuing, so it waits for responses, meaning it's synchronous.
- Choreography: (ASYNCHRONOUS) No central service. Services react to events and decide what to do/ what to compensate. e.g. when client puchasedgoods, if it failed, it sends FAIL event to MQ, maybe a notification service subscribing to this FAIL event will react on this and nothing else, else if it succeeds, it sends SUCCESS event to MQ, other services like