cdddg/py-saga-orchestration

This is great and simple code

dimacv opened this issue · 2 comments

Greetings.
This is great and simple code.
I really liked it.
Thank you very much.

cdddg commented

Thanks

Let me clarify a few potentially confusing points:

  1. When the nth action (action_n) fails, should the nth compensation (compensation_n) or the (n-1)th compensation (compensation_n-1) be executed?

    My strategy is to execute the (n-1)th compensation, as I believe the action and compensation are a single step and the compensation should only be executed if the action succeeds.

  2. Regarding the parameter injection for actions and compensations:

    • Actions can use the result of the previous action as a parameter.
    • Compensations can inject the result of the action in the same step.

For more detailed information, please refer to this link: https://github.com/cdddg/py-saga-orchestration/blob/main/saga.py#L37-L69

Example: https://github.com/cdddg/py-saga-orchestration#complex-example

Many thanks for the additional clarifications and examples.