X

@OracleIMC Partner Resources & Training: Discover your Modernization options + Reach new potential through Innovation

  • August 29, 2017

Process Cloud Service - Using correlations to communicate between processes (part 1)

There are several possible ways to communicate between processes like, request and response, fire and forget, calling sub-processes using call activities. All of those create a new process or sub-process which interacts with the old one. But what if we need to communicate with the specific already active instance of the process. The solution is to use correlations.

This blog post, comes as a detailed guide next to Partner Webcast – Inter Process Communication with Correlations in Oracle Process Cloud Service. As in the Partner Webcast demo, we will describe how to create two processes in Oracle Process Cloud Service communicating using correlation. There will also be a additional post describing how to demonstrate correlations using PCS Player.

The case is very simplistic (see below) to focus only on correlation in action.

First Process defines the correlation unique key during Start Event then waits for the message from the second process.

Second process sends the same unique key to first process together with the message.

When the First Process receives the message it proceeds and displays the message in user interface.

The following sequence of actions is needed to define user interfaces of start events for both processes :

  1. Open Oracle Process Cloud Service Home page
  2. Select Develop Processes
  3. Create new application - name it Correlation Demo
  4. Create two processes "First Process" and "Second Process" both started with a form
  5. Open "First Process" select Start Event, open its properties. You need to set the title to "First Process initialize" and create new form using NewWebForm 
  6. In the form Designer drag and drop two input text elements and name them correlationKey  and initalMessage, change their labels to "Define Correlation Key" and "Initial Message"
  7. Go to "Second Process" open properties of the Start Event
  8. Set title to "Initialize Second Process" and create new from named SecondProcessStartForm
  9. This time use Forms palette - and reuse elements already created for FirstProcessStartForm 
  10. Click "Detach" and existing update labels to Key and Message 
  11. Click Save

Add Catch Intermediate Event to the first Process:

  1. Open "First Process"
  2. Drag and drop intermediate message catch event after Start Event
  3. Open its properties
  4. Set type to Define Interface and click on the pen button
  5. Change the operation name to catchIntermediateEvent
  6. Add two arguments by clicking plus button name them key and message keep type string for both like in the diagram below
  7. Click Save

Define Correlation

  1. Click on the correlation button:
  2. The pop-up correlations window will appear
  3. Click + button
  4. Add correlation named ck1
  5. Add one property name it key and type string
  6. Click << button see diagram below
  7. Click Apply button

Initialize correlation

  1. Select Start Event and Open its properties
  2. Select Correlation tab
  3. Click + button
  4. The system will show all available correlation keys - in our case there will be only one ck1 previously created.
  5. Please select ck1
  6. Click fx button located in the properties table
  7. Then Expression Editor window will appear.
  8. Expand formArgs, select correlationKey
  9. Click "Insert Into Expression ^"  button then click Validate button
  10. If the expression is valid then click OK button

Set correlation event

  1. Select "Message Catch Intermediate Event" and Open Properties
  2. Select correlations tab but this time instead of Initialize Tab we need to select Correlate tab
  3. Select + button to select ck1 correlation key
  4. Click fx button located in the properties table
  5. Expression Editor window will appear. Expand formArgs, select correlationKey
  6. Click "Insert Into Expression ^"  button
  7. If the expression is valid then click Validate button
  8. Save

Add user Task to show the received message to the user

  1. Drag and drop new user task after  "Message Catch Intermediate Event
  2. Open properties of the User task

  3. Add new webForm name it UserTaskForm

  4. Click Create button

  5. We want to reuse forms created for initialization of first and second processes

  6. Go to Forms Palette and drag and drop FirstProcess.. and SecondProce... objects

  7. This time we will not detach those elements because we need exact copies of the original elements

  8. Save

Add global variables to First Process - we need them as an output from "Message Catch Intermediate Event"  and input to UserTask

  1. Go back to the first process
  2. Select "Message Catch Intermediate Event" and "Open Data Association"
  3. Expand FirstProcessData and select Data Object
  4. Click + button
  5. Add two data objects key and message both type string
  6. Drag and drop key object from Message Catch Intermediate Event - Output to  left  entry field in Transformations table
  7. Do the same with newly created key Data Object to the  right  entry field in Transformations table
  8. Afterwards a new row will appear in the Transformations table ready for repating previous steps but this time with message objects
  9. Click Apply button

Assign data for UserTask

  1. Select UserTask "Open Data Association"
  2. Be sure that  input Data association was selected
  3. We need to associate data like in the diagram below
  4. Click Apply button

Define message from Second Process to First Process

  1. Select  Second Process
  2. Change End none type Exit event into end message event like in the first diagram below
  3. Open its properties
  4. Select Type to Process Call
  5. Click pen button
  6. Using magnifying glass search processes
  7. Select "First Process" and Target Node "Message Catch Intermediate Event"
  8. Click OK button
  9. Open Data Association for the End event
  10. Set up Input data Association for CorrelationKey and initialMassage like in the second diagram below

 

Now the application is ready for deploying and testing, but before we need to publish it

 

  1. Select publish button - see below
  2. Enter mandatory comment text then

  3. Click Publish button

 

 

Continued in Part 2...

 

 

 

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.