Use Correlations to Communicate Between Processes

Are you looking for another way to get your processes to talk to one another? Let’s look at how you can develop a process that uses correlations to communicate with other processes and services.

Correlations Lead to Process Communication

Correlations enable business processes to communicate with each other based on the state of an instance. The state of all the process data objects in a process defines the state of the instance.

When you define a correlation for a business process, you can identify an instance in another process based on the instance state and then send a message to that specific instance.

For example, you can use correlations to communicate a sales process with the corresponding shipping and mailing processes. When the customer confirms an order, the shipping process sends a message to the shipping and mailing processes using a correlation that defines that it uses the order ID to locate the instances in both processes.

After you initialize a correlation, you can’t change its value because the service engine uses this value to locate the instance.

You can define and initialize multiple correlations for a flow element.

  • The flow element that sends the message can use just one correlation or all the correlations defined for that flow element. If the flow element uses all the existing correlations, then all the values it sends together with the message must lead to the identification of the same instance.

  • Some flow elements are able to initialize a correlation (that is, Start), some to use it (that is, End), and some to both initialize and use (that is, Receive Task).

  • For those activities that manage input and output arguments, such as the service task, you can set the property value based on one or the other.

The scope of the correlation is the instance of the process or subprocess where it’s defined.

Be careful not to initialize the same correlation more than once. If you do, you’ll get an error at runtime.

Components of a Correlation

The main components of a correlation are definition, keys, properties, and property values.

  • Correlation definition contains the set of correlation keys defined for a flow element.

  • Correlation keys define a unique name to identify the properties to use in the correlation. When you define a correlation key, you provide a name to identify it. The scope of the correlation key is the process, which means that after you define a correlation key you can use it for the correlation definition of any flow element in that process.

  • Correlation properties are abstractions for very representative attributes in the process, like the order ID, the customer name, or the social security number. Properties contain a name to identify the attribute and a data type. Properties only support basic data types. The scope of the properties is the application. You can see the property definition in the different processes.

  • Correlation property values enable you to define how to assign a value to the correlation property using expressions. You can use the arguments and predefined variables of the activity to set the correlation property values.

Define Correlation Keys and Properties

You define correlation keys at the process level, which means you can reuse correlation keys across your process and flow elements.

To define correlations keys and properties:
  1. Go to the Process Applications page.
  2. Open your application.
  3. Open your business process.
  4. Click Correlations Correlations icon in the toolbar. The Correlations dialog box opens.
  5. Create the correlation keys and properties, and then associate one or more properties with each key you create. Use the arrow keys to move information between the Keys column and the Properties column.

Use Your Correlations in a Process

You can define multiple correlations for a single flow element (that is, an activity). The activity that sends the message can use one correlation, several correlations, or all of them. The values used to invoke the correlation lead to the identification of the same instance.

To communicate between processes, you can define correlations for the following activities:

  • Message start and message end events

  • Message throw and message catch events

  • Send and receive activities

  • Signal events

To define and use correlations in your processes:
  1. Go to the Home page, click Processes, and then open your application.
  2. Design and build the two processes that will communicate with each other. One process is the calling process; the other is the invoked process. For example:
  3. Open the properties for an activity.
    1. Select the activity in your process diagram.
    2. Click Menu Menu icon and select Open Properties.
      The Properties pane opens at the bottom of the window.
  4. Define the general properties.
    1. Select the General tab.
    2. Define how you want to implement the activity.
    3. Click Edit Edit icon to add arguments, and define the name and type of each argument.
      Define the input arguments for message start and message catch events and for receive activities. Also, define the output arguments for message end events and for send activities in the invoked process. See Define Input or Output Arguments.
      If the required arguments aren’t defined, then you can’t configure the correlations. The Correlations tab displays a disabled pane.
  5. Define the correlation properties.
    1. Select the Correlations tab.
    2. Define a correlation and configure it to initiate the property values.
      A few things to note:
      • In the Keys box, click Add Add icon and select one of the available keys. If no keys are defined, then you need to create them. See Define Correlation Keys and Properties.

      • After you select one of the available keys, the contained properties display in the Properties box. To set values for the properties, click Expression Editor Expression Editor icon to open the editor.

      • Some activities are only able to initialize correlations (configured on the Initialize tab) while other activities are able to use the correlations (configured on the Correlate tab). Also, for activities that have input and output arguments, you can select one or both, and then set the property values according to the selected context.