Thursday 22 September 2011

Oracle BPEL 11g - Correlation Sets

Correlation Sets is as set of configurations that allow the process to receive messages during its execution even if the invoker doesn't have the Correlation ID necessary to indicate to the engine to which instance the message needs to be delivered. With Correlation Sets a group of business data can be used to inform the engine how to match the message received with the correct instance that is already in execution.

To understand correlation sets is necessary to know some main concepts:
  • Property: like a variable, a property stores the information that will be used to match when a new message arrives.
  • Property Alias: is used in two situations - as a assign, to define what information needs to be stored in the property, and as a query, to match the information received in a message with the information stored in the property.
Itens below is a step-by-step showing how to configure Correlation Sets:

1 - Create a new operation in the process interface, allowing it to receive a message during process execution
  • Open the WSDL that describes BPEL service interface. Find messages and operations already defined.
  • Create a new message and a new operation in the inbound PortType that uses the message created. You can use some data type already defined, define a new data type at the XSD file already imported by the WSDL or import any XSD to use a data type defined externally.
  • Verify that the new operation is available at the process interface.

2 - Change the process to use the new operation during the process execution
  • Open the BPEL process and add a new Receive activity in the middle of process execution. Before and after this Receive you may have as many activities as necessary. Point the new activity to the PartnerLink that represents the process interface.
  • Select the operation defined previously on WSDL and create a new variable to store the message that will be received.

3 - Create and initialize the Correlation Set with business value that will be used to match the message that will be received
  • Open the Receive activity that starts the process. Select the "Correlation" tab and click on "Create" button. Important: to initialize the Correlation Set you could use any Invoke or Receive activity before the Receive activity you will receive the message that you want to match.
  • Define Correlation Set name and click on "Add" button.
  • Choose the "input" field from "InputVariable". Click on "+" button right to "Property" field and define the name of the property that will store the input field value.
  • Click "OK" once to confirm Property creation, again to confirm Property Alias creation and one more time to confirm Correlation Set creation. Change "Initiate" field to "yes". This will indicate to the engine that you want to initilize the Property with the field content defined by the XPath expression of the Property Alias.

4 - Match the incoming message
  • Open the Receive activity that will receive the intermediate message. Select the "Correlation" tab and click on "Add" button.
  • Select the Correlation Set previously created and click on "OK".
  • Select the Correlation Set added and click on "Edit" button.
  • Select the Property of the Correlation Set an click again on "Edit" button.
  • Choose the "input" field from Intermediate Receive's variable and click "OK". Then, click "OK" again to confirm the Correlation Set change. This will create a new Property Alias that matches intermediate message value received with the value stored in the Property initialized previously.
  • This time, leave the "Initiate" field as default ("no"), because we don't want to change the property value. We just want to match its value with the value received by the Intermediate operation message.

With this configuration, BPEL engine can match business value stored in the property (initialized in the first Receive activity) with the the message value received by the Intermediate Operation and deliver the message for the correct running instance.


To download this sample, click here.

No comments:

Post a Comment

xslt padding with characters call template for left pad and right pad

  Could a call-template be written that took two parameters ?   a string, and a   number) return the string with empty spaces appended t...