You say "during the workflow, the engine has to be in charge of the execution". That is true, but because it is implemented in a stateless webworld the logic is a bit the other way around: the controller is in charge and delegates some decisions to the workflow engine.
Hello,
I have a question about my GSOC project the Workflow engine.
I use Sebastian Bergmann low level workflow engine which is very well written.
There are two parts :
- the graph definition or workflow with nodes, different types of branching and merging.
- the execution engine allowing to execute the graph.
The goal is to execute controller tasks which are mapped to graph nodes.
Let's say a user enters a checkout process of an e-commerce extension.
The corresponding task starts the workflow execution by calling the engine, then the engines knows task A of Controller B has to be executed, then task C of Controller C on success, task D on failure (it depends on the graph...).
So during the workflow, the engine has to be in charge of the execution : the executed task provides values to the engine (for example : payment success, failure) so he knows which branch to choose for example (so which task as a follower).
I think a plugin with the onAfterExecute event would do the trick : supposing the engine knows which task to execute from which controller, he can call it.
I'm wondering if this is the best way, and how to do it ? It should work with both JApplicationWeb and JApplicationCli if possible and I don't know if instanciating a controller and execute a task from a plugin is a good way...
Thanks.
Regards,
Florian
Let's say a user enters a checkout process of an e-commerce extension.
The corresponding task starts the workflow execution by calling the engine, then the engines knows task A of Controller B has to be executed, then task C of Controller C on success, task D on failure (it depends on the graph...).
That sounds great to me! And by implementing an AND-split in the graph, parallel tasks - as Amy describes - can be easily done.
Maybe we have to think a bit about the exact way the controllers will be used. For now we mostly have a main-controller, a kind of dispatcher, and sub-controllers, that are instantiated by the main-controller. I can imagine that when a workflow-engine is available we can reorganise that structure too. But that is for later.
It will be based on ezcWorkflow by Sebastian Bergmann which is open source.
I don't know exactly how it must be used inside a MVC but my idea is to create a type of node that can be mapped to a controller task, so during the graph execution, the engine knows which task to execute. The definition of the graph and nodes, tasks mapping will be done via the Definition API (during the extension installation for example) or xml (I'm not sure If I will have enough time). For web applications, there are two possibilities : the engine is in charge of the execution (the master) or it helps to set the redirection dynamically (I think it's better).
The eventual problem is : during the execution there are sql queries otherwise the workflow state is not persistent, so it can slower the execution.
For daemons applications the engine must master the execution, instanciate controllers, execute tasks, fork processes if needed. So there is an other case.
FYI: the workflow in the installation of the Joomla!-CMS is controlled client-side: Javascript-code manages the sequence while keeping in touch with the server (Ajax). That could also be a way to implement a workflow-engine for a web-application, although I don't think it is useful for what you try to achieve in your project: something that works as well for a web-application as a daemon. I just mention it for completeness; always good to know the other tricks up the sleeve.
Thanks for the answers.
I think I will implement the state patern for the Engine (maybe Command also) and the nodes.
I'm going on a fork, trying to simplify some things and adapt some concepts to Joomla.
Regards,
Florian Voutzinos
Thanks for the answers.
I think I will implement the state patern for the Engine (maybe Command also) and the nodes.
I'm going on a fork, trying to simplify some things and adapt some concepts to Joomla.
Regards,
Florian Voutzinos