Open szoio opened 5 years ago
Id be interested in this enhancement, Im looking at simple sourcing and importantly simple sagas for a new application we are building. part of the application is modelled around general journal entries. The requirement is for a dynamic set of debit/credit pairs to complete as an atomic unit. Open to suggestions if this can already be catered for in the current libraries
I think you wouldn't need a dynamic saga for this. You could have a saga consisting of a debit and a credit, and if either fails, the other is reversed.
but if the number of debit and credit pairs within a single "journal" are not known, would this still apply? For example if I want the below journal examples to occur. In our initial modeling, the credits are acting as disbursements of the single debit amount. The number of and disbursement amount would be determined by applying a configuration provided by an upstream service.
scenario 1:
account | DR | DR |
---|---|---|
1 | 13.00 | |
2 | 10.00 | |
3 | 1.50 | |
4 | 1.50 |
scenario 3:
account | DR | DR |
---|---|---|
1 | 100.00 | |
2 | 50.00 | |
3 | 25.00 | |
4 | 15.00 | |
5 | 5.00 | |
6 | 5.00 |
Yes, this would work fine. This level of dynamism is supported already. The saga (i.e. the saga graph) is defined at the client side at run time. In scenario 1 you'd create a saga that debits account 1 and credits 2-4. In scenario 3 you'd create a saga that debits account 1 and credits 2-6 etc. As long as the saga coordinator knows about credits and debit actions it should work. You'd only need a dynamic capability (as in this issue) if the some of the saga actions need to know what the outcome of previous actions were in order to be able to execute.
interesting..ill keep plugging away then :)
Saga definitions are currently static as a design choice for simplicity. Should this capability be extended to include dynamic Saga definitions. This is a fundamental feature that would need some discussion. Possible options: