Rollback Chains: When Payment Fails, What Actually Happens
In the previous post, I showed the orchestrator's state transition table. It knows which topic to publish on failure. But what happens on the receiving end? What does "rollback" actually look like in code?
This post walks through three real failure scenarios in my saga system. Each one triggers a different rollback chain, and each service handles compensation differently.
How Compensation Works
Every service implements two operations: the forward action and its compensation.
Service Forward Compensation
product-validation validateExistingProducts() rollbackEvent()
payment-service realizePayment() realizeRefund()
inventory-service updateInventory() rollbackInventory()
The forward action does the work and publishes SUCCESS or ROLLBACK to the orchestrator. The compensation undoes the work and publishes FAIL .
There's an important distinction between ROLLBACK and FAIL .…