cancel
Showing results for 
Search instead for 
Did you mean: 

BPMN guidance

aoliver
Champ in-the-making
Champ in-the-making
Hello,
I have a BPMN question.  I currently have 2 distinct workflows; we'll call them Workflow1 and Workflow2.  Currently, Workflow1 is triggered by a spring-integration file poller.  When the file arrives in the polled directory, Workflow1 process instance is started.  Workflow2 uses a spring scheduler to wake up and look for a status in a database table.  Additionally, Workflow2 checks to see if it already ran today.  When the status is appropriate and the process has not run today, Workflow2 process instance is started.  These 2 workflows are independent of each other.  Also, Workflow1 and Workflow2 contain long-running tasks and are implemented using Receive/Wait tasks.

However, a new requirement is that after both Workflow1 and Workflow2 have been completed, Workflow3 (a new workflow) must be started.

I'm imagining that Workflow1 and Workflow2 should become either subprocesses or call activities and connected via parallel/join gateways and subsequently connecting to Workflow3 after the join, as such:

[img]
http://activiti.org/userguide/images/bpmn.parallel.gateway.png
[/img]

However, my queston is how to invoke Workflow1 and Workflow2 subprocesses/call activities independently and yet still join to invoke Workflow3 subprocess/call activity?  Should i create receive tasks for both Workflow1 and Workflow2 subprocesses/call activities that perform the file polling and database polling which, when conditions are met, will signal the subprocess to continue?  Or should i use a boundary event?  Or is there a more appropriate way to achieve this in BPMN?

Also, if these subprocesses are wrapped in a workflow, what would be the appropriate way to start the parent workflow?  Basically, when the parent workflow completes, it needs to run again.

Thank you for your expert assistance.
3 REPLIES 3

jbarrez
Star Contributor
Star Contributor
Do you mean that workflow 3 can only be executed *once* for each pair of workflow 1 and 2 that has been executed?

If so, than indeed you will need call activity + a parallel gateway join.
You will also need to implement some kind of loop + condition check for your workflow 1 and 2 to see if they can be executed.

aoliver
Champ in-the-making
Champ in-the-making
Yes, Workflow3 can only execute after both Workflow1 and Workflow2 are completed.

Could you point me to an example of the BPMN constructs used for the loop + check condition you are referencing?

Thank you again for your help.

jbarrez
Star Contributor
Star Contributor
Well, there is loop support in BPMN, but that is too complex for this.

I would simply do seomthing like this

Check condition workflow 1 —(ok)–>  execute workflow 1 –> go to join
                                            –(not ok) –> timer intermediate event –> go back to step 1

And the same for workflow 2.