This documentation is for WSO2 Enterprise Integrator version 6.5.0 . View documentation for the latest release in the 6.x.x family and the latest release in the 7.x.x family.

All docs This doc
||
Skip to end of metadata
Go to start of metadata

Objective

This sample illustrates <pick/>, where a process instance execution can be specified based on a particular received event. The received event can be <onMessage/> or <onAlarm/>. Additionally, users have to define a correlation set and refer it in each event in order to determine the correct execution path.

Deploying the Sample

WSO2 BPS provides a sample, which can be deployed and executed to understand the Pick construct. Follow the instructions below to deploy and trigger the process.

1. Log in into BPS server management console and select "Processes -> Add" under the "Main" menu.

2. Upload the <EI_HOME>/samples/business-process/bpel/PickOneWay.zip directory.

3. In the "Deployed Processes" window, click the "Process ID" to access its "Process Information" window.

4. Under the "WSDL Details" widget, trigger the process using the "TryIt" link to create an instance of it.

Example Usage

Refer to PickOneWay.zip when going through the following instructions.

Defining correlation set
<correlationSets>
   <correlationSetname="CorrelationByDeck"properties="srvns:deck"/>
</correlationSets>

This property is defined in the PickService.wsdl as follows.

<vprop:propertyname="deck"type="xsd:token"/>
<vprop:propertyAliasmessageType="tns:dealDeckRequest"part="parameters"propertyName="tns:deck">
    <vprop:query>tns:Deck</vprop:query>
</vprop:propertyAlias>

The property points to a particular message element which is called <Deck/> in the dealDeckRequest message type. For example,

<dealDeck>
    <Deck></Deck>
</dealDeck>

Once a message of the type dealDeckRequest is received, an instance of correlation set will be created based on the value of the element <Deck/>. In this sample, when a dealDeckRequest message is received, a process instance is created due to createInstance="yes". Also, a correlation set instance is created due to initiate="yes".

<receiveoperation="dealDeck"partnerLink="IncomingLink"variable="deckRequest"createInstance="yes">
    <correlations>
        <correlationinitiate="yes"set="CorrelationByDeck"/>
    </correlations>
</receive>

Suppose there's an incoming message for an operation defined in <onMessage>. Once the message is received to the process, it'll be verified with correlation set instance. If there's an existing process instance which is compliant with the correlation set instance, then the instance will execute the particular set of activities defined. If the incoming message's operation is "pickSpade", the partnerLink is "IncomingLink", and the incoming message is compliant with the correlation set instance of the process instance, following activities are executed.

<onMessageoperation="pickSpade"partnerLink="IncomingLink"variable="spadeRequest">
    <correlations><correlationinitiate="no"set="CorrelationByDeck"/></correlations>
    <sequence>
       <assign>
         <copy>
           <from>
              <literal>
                   <pickSpadeResponsexmlns="http://www.stark.com/PickService"><Deck/></pickSpadeResponse>
              </literal>
           </from>
           <tovariable="spadeResponse"part="parameters"/>
         </copy>

         <copy>
           <from>bpel:getVariableProperty("spadeRequest", "srvns:deck")</from>
           <to>$spadeResponse.parameters/srvns:Deck</to>
         </copy>

       </assign>
       <replyoperation="pickSpade"partnerLink="IncomingLink"variable="spadeResponse"/>
    </sequence>
</onMessage>
  • No labels