I need to create (payment) transaction system. Transactions contains some actions/steps, some actions depends on another, but some can performs in parallel.
Synthetic example:
Transaction:
1. get confirmation
2. get balance
3. check in fraud system (can be in parallel with 1 & 2 step)
4. hold (depends on 1 & 2)
5. make request to payment provider (depends on 3 & 4)
6. finish (depends on 5)
In this example we have few steps that can perform in parallel and some steps that depends and wait for other action. I plan to store actions in database with references to dependencies (steps that should be performed before).
I plan to use some kind of status model for states of actions like WAITING, READY etc. (Actually examples of status models another good question) And also I want to make some structure to work with (biggest problem).
At first I plan to use tree, where top of tree is FINISH and all operations execute from leaves to top, but I have some different actions that can depends on same leaf (I mean different leaves that have link to the same leaf(action) below) and I thinking about using some kind of graph.
I'm in search for good examples, references and practices, books about writing this kind of software.
Aucun commentaire:
Enregistrer un commentaire