Compensating Transaction Pattern

Provides scenario for when an operation within a set of bundled operations fails 

Instead of wrapping them in atomic transaction

The compensating transaction will undo the effect of the original failing transaction

The compensating transaction is not a mirror of the original one, but rather a way to put data back into eventually consistent state 

We can use workflows to register bundled operations as they are performed

Compensating operations  might run in different orders than the original ones

Both original and compensating operations should be defined as idempotent commands

Compensating Transaction Pattern

By hkoundi

Compensating Transaction Pattern

  • 1,291