Wednesday, December 17, 2014

Oracle BPM 12c Gateways (Part 3 of 5): Parallel Gateway

The parallel gateway enables you to perform multiple tasks simultaneously, allowing your process to follow several unconditional paths in parallel. When your process token reaches a parallel gateway activity, the parallel gateway will create a token for each outgoing parallel sequence flow. Your process will wait until all tokens have arrived at the parallel gateway merge activity before resuming with the rest of the activities.

You should be very careful with the parallel gateway activity because if one of the tokens that have been created by the parallel gateway doesn't arrive at the parallel gateway merge activity, then your process will freeze.

So let's see how you can use the parallel gateway in a process. Let's assume that you are implementing an order process and that at some point in your process you want to request for quotations from two different suppliers. Once you have received both quotations your process should resume (ideally pick the lowest quotation but I will not be implementing this part).

I created a BPM application with a default BPM project (named both application and project "ParallelGatewayDemo") having an empty composite.

Next I created an asynchronous BPMN process and named it OrderProcess without any arguments.

As already stated above in this demo I will be simulating an order process where I need to send two supplier quotation. So I will use the parallel gateway. Please note how JDeveloper automatically adds a parallel gateway merge activity when you drop a parallel activity on your process.

To simulate a supplier's request for quotation I used a human task component. I created a single human task for both suppliers accepting all the defaults and just changing the human task title for each case.

For simplicity reasons I changed the human task assignment type from "Lane Participants" to "Names and expressions" and assigned the "weblogic" user as a new user participant.

So let's test our process. Since we didn't specify any arguments you can directly invoke your process. If you open the flow trace you will see that two human tasks have been created and are pending.

Go to the BPM workspace, login using the weblogic user and if you followed my exact steps and you should see two tasks. Approve one of them.
If you go back to the flow trace you should see that there process is waiting for the second human task.

Approve the second human task (from the BPM workspace) and go back to the flow trace; you process should be completed.

Both tokens from both outgoing parallel sequence flow have reached the parallel gateway merge activity which signaled to the process that all parallel activities have been completed.

Download sample application: Parallel Gateway

No comments:

Post a Comment