Oct 18th, 2012, 06:05 AM
Randalf the Red
While researching on configurable workflows, I went through some readymade tools such as Windows Workflow or other opensource BPM/Workflow management tools. However one of my seniors suggested a (seemingly) simpler approach.
Start with a file based configuration of how the workflow should be. For an order management module, at a very simple state, this includes storing the present state and the next state. Based on the present state of an order, it could be pushed into the next state or cancelled.
This much is easy to implement. Now there's another requirement: When pushing an order from one state to another, there may be several things to be done. For e.g. generate an invoice, email the generated invoice to the client, make an entry in some table and so on and so forth. So there's the core action of updating the order state, and the supporting actions which make a complete business/use case.
One of the ways the senior told us is to simply write the necessary method names in the configuration file. So if the order has to move from created state to the approved state, the file would also capture a list of methods (maybe fully qualified) to execute before the state changed, or after the state changed.
How do I manage this?
An example can be of a csv file with the following columns:
I know this is complex, but I need some simple way of getting this to work. The ensuing complexity can then be managed.
Nov 6th, 2012, 10:46 AM
Re: Configurable Workflows
I'd be a little cautious about this statement:-
"Based on the present state of an order, it could be pushed into the next state or cancelled"
In my experience there may well be several possible "next states". Or it could loop back to a previous state. Workflows are generally directed graphs rather than linear functions. That said, if you can keep yours purely linear you'll make your life much easier so pitch for that if you can.
Are you asking how to lay it out in the file? If so I'd recommend a format that has some hierarchical structure e.g. xml because you're going to need to store an indefinite number of actions for each state transtion (as well as an indefinite number of condtions, outcomes and destination states if you find you need to implemet a directed graph). In fact I'd probably go further and store it in a DB if it was me but I'm probably biased by the fact that dbs are my strong point.
Are you asking how to take that configuraton and run the apropriate method, in which case you want to bone up on reflection.
Or are you asking something else I haven't thought of.
When one of my minions says, "Hey, he's just one guy, what can he do?" I say "This"... and shoot them.
The problem with putting your lair in a volcano is keeping your robot army from melting.
I know that the human being and the fish can coexist peacefully - George Bush
Click Here to Expand Forum to Full Width