Gopalan Suresh Raj
Web Cornucopia
Gopalan's Profile
Archives
« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today
Click me to subscribe Download Open ESB
Syndication
Search

Table of Contents
Tags
bpel choreography ejb esb http integration javacaps javaee javaone jax-ws jbi management openesb orchestration process-oriented rest sca service-oriented soa soap wsdl xml xsd
Links
 
Referrers

Today's Page Hits: 102

Map of Visitors
Locations of visitors to this page
Caveat Emptor
This is my personal weblog. The contents of this Weblog represent my personal opinion which may differ from the official views of my employer, Sun Microsystems, Inc. or any past employers. I do not speak for my employer or any past employers.
View Gopalan Suresh Raj's profile on LinkedIn
« The simplicity and... | Main | BPEL: Lifecycle of... »
Tuesday Jul 04, 2006
Jul
4
BPEL: What is Correlation, message Property, Property Alias, and Correlation Set
What is a BPEL Correlation?
At the start of a Business Process, a new process instance is created and it lives for the lifetime of the business process. Since there might be multiple business-process instances active at the same time in the BPEL Engine, all messages sent to the business process have to be delivered to the correct business process instance. BPEL process instances communicate with each other by invoking partner web services. The structure of the application-data passed around is transparent to the BPEL engine since BPEL partner services do not address each other by an identifier. However, the messages passed around contain key fields that can be correlated for the lifetime of the exchange. Since multiple business-process instances are active at the same time, business-application-specific data (like social security numbers, insurance-claim numbers, tax payer IDs, or any business-application-specific identifiers) available in the exchanged messages are used to maintain references to specific business process instances. This idea of associating business-application-specific data found in the messages to maintain references to specific business process instances is termed BPEL Correlation.

Any business-application-specific data used for correlation is contained in the messages exchanged by the BPEL partner services. The exact location of the correlation identifier varies from message to message and is specific to a business process. To specify which business-application-specific data to use for correlation, message properties defined in the WSDL file are used. To brook an analogy, think of how you define and use a primary key to access all records associated with this key from your domain model.

Message Properties (<property>) defined in WSDL files
Messages exchanged by partner services in a BPEL Engine usually contain business-application-specific or application-specific data which are used by the business processes. Message Properties defined in the WSDL file using the WSDL extensibility element mechanism, create an association between relevant business-application-specific data to a name that can have an important role to play in the global context of the business process and can therefore be used for Correlation. Since these message properties are mapped to multiple messages, it makes sense to name them with global property names.

<?xml version="1.0" encoding="UTF-8"?>
<definitions ...    
             xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
             ...>
  ...
  <bpws:property name="claimNumberProperty" type="xsd:string"/>
  ...
</definitions>


<propertyAlias> defined in WSDL files
Property Aliases are used to map properties to messages. Message parts contain business-application-specific properties. A property alias maps a specific property to a specific element or attribute in a message part. Once defined, it is possible to use the property name as an alias for the message part and the location of the property within the message. Property Aliases are defined in the WSDL file using the WSDL extensibility element mechanism. The query expression used to access the relevant element or attribute is written in the selected query language, the default being XPath 1.0.

<?xml version="1.0" encoding="UTF-8"?>
<definitions ...    
             xmlns:bpws="http://schemas.xmlsoap.org/ws/2004/03/business-process/"
             ...>
  ...
  <bpws:propertyAlias propertyName="tns:claimNumberProperty"
                      messageType="ns1:getClaimNumberResponse"
                      part="parameters">
    <bpws:query>/getClaimNumberResponse/return</bpws:query>
  </bpws:propertyAlias>
  ...
</definitions>

<correlationSet> defined in BPEL files
Correlation sets are used to tie together a partner conversation and are used to associate messages with business processes. A set of properties shared by all exchanged messages and used for correlation is called a Correlation Set. Each correlation set has a name as can be seen in the skeletal listing below. A message can be related to one or more correlation sets.

<?xml version="1.0" encoding="UTF-8"?>
<process ...>
  ...
    <correlationSets>
        <correlationSet name="claimNumber" 
properties="ns1:claimNumberProperty"/>
    </correlationSets>
  ...
</process>

There are two roles that can be defined when correlated messages are exchanged between different BPEL partner processes:
Both Initiators and Followers must mark their first activity that binds the correlation sets.

Correlation Sets can be used in multiple BPEL activities like <receive>, <reply>, <invoke>, <onMessage> parts of <pick> activities, or event handlers. The <correlation> activity that is present inside of any of the above mentioned activities is used to specify which correlation set to use. By default the value of the initiate attribute is set to 'no'. When correlations are used with the <invoke> activity, a pattern attribute is also required. These pattern attributes can have one of these values:

 ...
<sequence>
  ...
  <invoke name="InvokeClaimNumberer" 
          partnerLink="ClaimNumberer" 
          operation="getClaimNumber" 
          portType="ns3:ClaimNumberer" 
          inputVariable="GetClaimNumberInput" 
          outputVariable="GetClaimNumberOutput">
    <correlations>
      <correlation set="claimNumber" initiate="yes" pattern="in"/>
    </correlations>
  </invoke>
  ...
</sequence>
...




 ...
<sequence>
  ...
  <invoke name="InvokeAddNewAdjustmentJob" 
          partnerLink="Adjuster" 
          operation="addNewAdjustmentJob" 
          portType="ns4:Adjuster" 
          inputVariable="AddNewAdjustmentJobInput"/>
  
  <receive name="ReceiveSubmitAdjustment" 
           partnerLink="AdjusterCallback"
           operation="submitAdjustment" 
           portType="ns2:IAdjusterCallback" 
           variable="SubmitAdjustmentInput" 
           createInstance="no">
      <correlations>
          <correlation set="claimNumber"/>
      </correlations>
  </receive>        
  ...
</sequence>
...

Note: All examples use the Insurance Claim Composite Application Scenario described in this blog entry.

Download the Java EE 5 Tools Bundle Beta from http://java.sun.com/javaee/downloads/index.jsp for FREE, and provide us feedback on the improvements you'd like to see. It combines the new Java EE 5 SDK with NetBeans IDE 5.5 Beta, NetBeans Enterprise Pack 5.5 Early Access, and Sun Java System Application Server Platform Edition 9. This bundle also contains Project Open ESB Starter Kit Beta, Java EE 5 samples, Java BluePrints, and API docs (Javadoc).

The screen-shot below shows the WSDL for the Insurance Claim scenario in the Sun NetBeans 5.5 Enterprise Pack Beta WSDL Editor
The screen-shot below shows the BPEL for the Insurance Claim scenario in the Sun NetBeans 5.5 Enterprise Pack Beta BPEL Visual Designer
   



Posted at 05:22AM Jul 04, 2006 by Suresh Gopalan in BPEL  |  Listen to this article Listen to this entry  |  Comments added Comments[0]
Tags:
Share This Post: del.icio.us | furl | simpy | slashdot | technorati | digg

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

Disclaimer: The contents of this Weblog represent my personal opinion which may differ from the official views of my employer, Sun Microsystems, Inc. or any past employers.



View blog top tags

Enter your email address:

Delivered by FeedBurner

[Valid RSS]