Dynamic Update of Running WF 4.0 Workflow
There is a requirement in my project where i should implement an option where a user can change the workflow dynamically i.e. on runtime. To be more specific if a workflow passes through a set of activities let's say activities A, B and C. Then user should have an option of changing the flow like for e.g. instead of going from A->B->C they can go directly A->C skipping B.And this change in th开发者_如何学Ce flow should happen in runtime.
There are more than 3 activities(A,B,C mentioned above)the activities may go upto 20-30, and the user should have an option to go from go to any of the activities, or you can say that user should have an option to edit the flow on runtime.
Please help me out with this,is this option available in the windows work foundation (WF).
Thanks in advance
At the moment using WF4 you can't change the workflow definition of a running workflow instance. So either have to change the workflow before you start it or model possible changes to the workflow using conditional logic in the workflow yourself.
The next version of workflow will support changes to running workflows but when that will be available is unknown. Just don't expect it any day soon.
Capture the users decision in a way that the workflow can access it, then use an ifElse Activity to decide if you execute activity B or not.
This is just normal workflow modeling unless I'm understanding your question totally wrong.
Edit: As a response to your comment, it's probably possible to come up with a solution to that requirement, but it would be pretty ugly, because it defeats the purpose of the workflow engine.
If you treat a workflow like a shopping basket for users where she can just choose anything she likes, then it's not a workflow anymore. At least there should be some coherent steps that make no sense to disrupt. So maybe it makes sense to put these into separate workflows and let the user decide which workflow she wants to do next?
I would think about making 1 functor per activity and store the activities to execute on a list. This list being modified on runtime. The "core" would only have to parse the list and execute the functors.
精彩评论