These capabilities have been available for quite some time in Oracle's Process Cloud Service counterpart, the Oracle BPM Suite and have been described in detail in two of my blog posts; "Correlations in Oracle BPM 12c" and "Oracle BPM 12c Gateways (Part 5 of 5): Event-based Gateway".
Even though the functional concept is the exactly the same, whether used in an Oracle BPM Suite process or an Oracle Process Cloud Service process, there are yet some small differences, especially with the "Event Based Gateway" in Oracle Process Cloud Service.
So in this blog post we will see, in detail, how you can use the "Event-Based Gateway"to implement divergence and branching in your processes using events generated from external processes. Process communication will be implemented using "Correlations".
The scenario that I will use is quite simple and I will use two processes. The first process will simulate a warehouse inventory process that depending on the order id (supplied as a process request argument) will respond whether the stock item is available or not.
Next we will create the "Warehouse Inventory" process. From the "Create a Process" screen, select the "Message" pattern, give your process a name and click on "Create".
Edit the default "End" component and add two string response arguments, "orderId" and "status" and change the default operation name to "endWithNo". Change also the default label from "End" to "End with NO" (to distinguish between the two operations from the calling process).
Create a new process using again the "Message" pattern (I've named this new process "OrderProcess").
Drag and drop a "Message Send" task between the "Start" and "End" tasks and name it "Invoke Warehouse Process". Open its properties and from the "Type" drop down select "Process Call". Click on the "Edit" pencil button and from the "Process" search box select your "Warehouse" process. The "Target Node" should be automatically populated with the "Start" message.
We will be using only one correlation property and that will be the order id. Click on the "Correlations" button (located above your process on the button toolbar), create a new correlation key and a new string correlation property called orderId. Please make sure you shuffle the correlation property to your correlation key, otherwise you will not be able to use it.
In our case the initializer will be the "Message Send" task while the two "Message Catch" tasks will be the correlators. So go the "Invoke Warehouse Process" message send properties, select "Correlations" and click on the "Add" button to add the correlation key you created in the previous step. It should automatically detect the orderId correlation key property. You just need to assign a value to it and this will be the order id process data object.
We are now ready to deploy and test our application. Click on "Deploy" and select "Deploy new version". In the "Select Version" train stop select "Last Published Version" and click "Customize". Leave all defaults on the "Customize" screen and click on the "Validate" button. Ensure that your application is successfully validated and click on "Options". Set a revision id and click on "Deploy".