Question

I have workflow (attached image) with two Recieve Actions (Start and Finish). Both Actions correlate on WorkflowId parameter. I also have FinishWorkflow (bool) parameter.

I wanted to start workflow with Start Action and then then wait till FinishWorkflow parameter changes to true (using FinishWorkflow action).

I think that when FinishWorkflow action is finished, whole workflow finishes, so StartWorkflow action does not wait and check FinishWorkflow parameter. Do you know how to change FinishWorkflow action so it won't end whole workflow ?

TIA

enter image description here

Was it helpful?

Solution

Yes, your scenario is a bit hard to understand. Why is your Start Workflow inside a Pick? Are you expecting to cancel the Start Workflow operation?

You could of course get rid picks altogether and have a sequence with Start Workflow -> Do Some Stuff -> Finish Workflow but I suspect this is just because your diagram is over simplifying your scenario.

Possibly what you should be asking yourself is

How does the person/code calling my Finish operation get notified that the process can be finished or (depending on how you want it implemented) that their call to finish has failed and they need to try again later?.

If none of the above apply because your are using one-way messaging then one way to attack the problem is to keep FinishWorkflow inside a while loop with the condition set to "FinishWorkflow = false" therefore it will keep looping until the last call after the FinishWorkflow variable is set to true. You can then get rid of the Inner Pick, Branch2 and the delay etc. The only Pick you need is after the Start and branch one will contain your While with the Finish inside it and Branch two will contain whatever computation code you have that, when done, will set the finish workflow variable to true.

Remember that a Receive activity will block the current branch and wait for a message, therefore you do not need a delay to keep checking the value, in fact with a delay, your activity would be needlessly waking up and looking for input when there has been none. Quite expensive and non-scalable.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top