Fuego.Lib : Correlation

The Correlation component is used to associate a natural key to the current process instance, and to find instances that have been previously associated to a natural key.

A correlation is a set of one or more attributes that together define a unique key to identify a process instance. This component allows you to initiate or terminate a correlation on the current process instance, and to find a process instance that has had a correlation value assigned to it.

After a correlation value has been assigned to a process instance, the instance can be retrieved or notified using the correlation value as the identifier. Using PBL, you can notify a process instance with the Notification component. External applications can notify a process instance using the Process API (Java or Web Service edition).

For details on using correlations, see Oracle BPM Studio User Guide.

Example 1

This example establishes a correlation named "TechOrder" on the current process instance. The correlation defines two attributes: techcode and technum.

techcode = "EXAMPLE_VALUE"
technum = 1234
initiate Correlation
    using name = "TechOrder",
        values = [techcode, technum ]

Example 2

In this example, the Correlation component finds the process instance using the values of techcode and technum:

techcode = "EXAMPLE_VALUE"
technum = 1234
  findInstanceBy Correlation
      using name = "TechOrder",
      values = [techcode, technum]
      returning foundInstance = instanceId
 
display "Found Instance:" + foundInstance

Example 3

This example sends a notification (using the Notification component) to a process instance, identifying it by a correlation value:

correlationArgs as Any[Any]
correlationArgs["techcodeArg"] = value1
correlationArgs["technumArg"] = value2
// "techcodeArg" and "technumArg" match the correlation's properties
// defined in argument-set "TechOrderSet"
// of Wait Notification activity "WaitForNotification"
send Notification
    using processId = "TheOtherProcess",
        activityName = "WaitForNotification",
        arguments = correlationArgs,
        argumentSetName = "TechOrderSet"
Related reference
Fuego.Lib : Notification
Fuego.Lib : ProcessInstance