views:

173

answers:

1

I am looking to use WF 4 to replace an existing workflow solution we have. One feature that is currently used in the existing workflow engine is the ability to cancel a current activity and loopback to a FlowSwitch type activity.

So given the following crude workflow where we start at 'O' and base in the input data the workflow follows the path to 'A2' which is currently blocking on s bookmark waiting for input.

         ---------A1--\
         |             \ 
        /\              \
O-------  ---->--(A2)-------|
     ^  \/              /   |
     |   |             /    |
     |   ---------A3--/     |
     |                      |  
     |----------------------|

However in the meantime some out of band data comes in that means we should cancel 'A2' and return to the FlowSwitch to re-evaluate based on the new data. The question is what is the best way to handle the out of band data that arrived?

My initial guess is to have a Parallel activity with one branch waiting for out of band data and the other branch containing the workflow sequence described above. If data came in on the brach waiting for the out of band data, how would I cancel the current activity in the workflow and force it to return to the FlowSwitch. Or of course is there a better way to handle this.

I have not actually done any work with the WF4 stuff for WF3 for that matter so I might be missing something obvious here.

+1  A: 

You can do this with a pick activity instead of a parallel. This will let you wait for multiple events and the first to occur is the branch that executes. Next you can loop back to the top and start listening again if needed

Maurice
Hey Maurice, thank you. Just to be sure I have understood. I would have a pick activity with two pick branches, one waiting for the ad-hoc events and the other pick branch hosting the entire workflow as described above? So FlowSwitch -> PickActivity -> Back to flow switch, and the PickActivity hosting the two branches. Wow, I am struggling to put this into words :)
Chris Taylor
Or are you saying each of the activities A1, A2, A3 should be in a PickActivity one brach for the ad-hoc event and the other for the expected work?
Chris Taylor
==> are you saying each of the activities A1, A2, A3 should be in a PickActivity one brach for the ad-hoc event and the other for the expected work? Yes and below you decide what to do, either continue after the main activity, or loop back after the ad-hoc activity.
Maurice
Thank you! I will take a more detailed look into that.
Chris Taylor