com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_link3' is unknown.

Process Correlation

In this sample, we explore how to use correlation sets to route a message to an existing instance of a business process. We are going to use the simplest possible BPEL process. An Echo Process which accepts the same request message twice. The following is a sequence diagram for the sample scenario:

Since the second EchoRequest can either create a new instance of the EchoProcess or be routed to a previously created instance of EchoProcess, we require a correlation set.

Introducing CorrelationSet, Property and Property Alias

A CorrelationSet is a unique set of values contained in the message that is used by the process engine to select the correct process instance to send the message to. Correlation is done between two or more messages. A CorrelationSet can contain one or more properties.

Once we define a correlation property, we have to define the corresponding values in each of the messages we expect to correlate. These corresponding values are called Property Aliases.

Create the Process using WSO2 Developer Studio

  1. Create the business process. Use the following steps to accomplish this.
    1. Right-click on the Project Explorer and go to New > Project.
    2. Clicking project opens the New Project window
    3. Click Next and client creates the BPEL project.
  2. Generate a business process with the synchronous business process template. Use the following steps to accomplish this.
    1. Select a wizard from the subsequent screen that appears after creating the BPEL project.
    2. Select the New BPEL Process File and click Next.
    3. In the resulting screen, enter the BPEL Process Name, the Namespace and the Template as shown in the below image.
    4. Click Next.
    5. Create a WSDL file by filling out the Service NamePort NameService Address and Binding Protocol as shown in the following image.
    6. Click Next and finish the process. The following screen appears.
  3. Drag and drop ReceiveAssign and Reply activities such that you get the following process.
  4. Click on the Assign activity and assign ‘input’ from the input variable to ‘result’ from the output variable.
  5. Similarly, complete the next ReceiveAssign and Reply activity by using the same partner link ‘client’. Now you have completed the process logic. Next you need to add the correlation set to two Receive activities.
  6. Create a correlation set by clicking on the ‘+’ sign next to Correlation Sets.
  7. Select the correlation set and select Properties and click Add.
  8. You see the Select a Property wizard. Click New.
  9. Give a Name to our correlation property and select Simple Type under the Defined As section.
  10. Select the data type for our correlation property. In this instance, you have selected a ‘Simple Type’.
  11. Click Browse. Now we have to select the data type from XML schema types. Select string as our type.
  12. Click OKNow a pop up box appears and asks for the prefix to be used to the XML schema namespace. Enter the prefix as ‘xsd’. 
  13. Click on the New button next to Alias to define the property alias. The Create Property Alias window appears.
  14. Select Message Type from the available options.
  15. Click on Browse. Also select input string for query.
  16. Click OK and finish the process.
  17. Now you have finished defining the correlation set, property and alias. 

    Note that you selected only one alias here because you are using the same message for both receive activities.

    Now we have to add the correlation set to the receive activities. On the first Receive activity, which creates the process instance, initialize the correlation set. On the next, Receive activity; it is not necessary to initialize the correlation set. Click on the Receive activity, and go to Properties, click Add and select the correlation set. Since there is only one correlation set, it is the only one that appears. On the Initiation section select Yes.

  18. On the next correlation activity, set Initiation to No.
  19. Next, generate the deployment descriptor.
  20. Next select all files related to the project and create a ZIP package.  Upload the BPEL package. Once the process is deployed successfully; we can use tryit to send a request to the process.
  21. Now navigate to the instance view for this process. The instance has completed up to the Reply activity and is waiting on the next Receive activity. Under the correlation properties; you can see the value sent in the request.
  22. Now send the same request from tryit again. The process instance has gone to the completed state. You can follow the same steps used here to add correlation sets to any asynchronous business process you implement. Correlation sets can be added to ‘receive’, ‘invoke’ and ‘pick’ activities.
com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.