Menu

Post image 1
Post image 2
1 / 2
0

Rollback Chains: When Payment Fails, What Actually Happens

DEV Community·Pedro Santos·about 1 month ago
#krcoFDIn
Reading 0:00
15s threshold

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 .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More