My app needs to pull data from MULTIPLE sources. The following needs to be user defined
- Order of the data sources
- Within the Order, Conditions (if at all) determine whether to use a data source or skip it
Once the user has defined the above two, the app will assign a name to his “orchestration” that he subsequently will use to pull the data.
I want some guidance on
- whether I am better of writing my own code to handle the order and conditions OR is this a state machine use case
- If it is a state machine use case then which is the better open source project providing this support
- Is there any specification for state machines? SCXML?
- Which are the best open source implementations of state machine? Criteria (in this order): Based on standard, easy to debug, easy to embed, actively being developed, support for runtime creation of the state machine
Use case: This is a multi-tenant app. Each customer is going to design his own orcehstration and save it to the db. This we call as boarding the customer. Once a customer has been boarded, all his requests will use the orcestration he had saved earlier.
Now let us say there are 3 data sources A, B and C. Few of the possible orchestrations are
- Orchestrion 1: Pull A, Pull B and
then Pull C in that ORDER - Orchestrion 2: Pull A, if A returned error then pull B, pull B (so basically (A or C) and B)
- Crchestrion 3: Pull A, B and C. order DOESNT matter. all need to be pulled (may be in parallel)
Rules of thumb for using a state machine:
For your purpose I would look at the JBoss Business Process Management suite. You have the ability to define and manage the state machine using an XML representation, including a GUI editor for allowing others to alter it, and then pass it to a “virtual machine” for execution. The definition language provides a lot of different hooks for custom code execution and modelling more complex behaviors such as processes in parallel, iterative activities and scheduled events.
Update in Response to Comment #1
I would study and compare SCXML and the jPDL specs. My impression is that SXCML is superset of jPDL, for instance jPDL has the ability to repeat tasks as part of its definition whereas SCXML does not appear so.