Petals Getting started - day 5 - EIP Orchestration

Hi ! Today is you last day. You will create a simple process: bufferize messages, and execute all of them in one time with MathOperations. You will use EIP chains for this.

Last tested with

This Tutorial uses:

  • Petals Studio
  • Petals ESB
  • Petals SE RMI
  • Petals BC SOAP
  • Petals Web console
  • Tomcat
  • soapUI
  • Petals SE Jsr-181
  • Petals SE EIP (new)
This tutorial is based on the use case: Bufferize operations with EIP.

Integration process definition

You will use Enterprise Integration Patterns (EIP, see below for explanations) to create this process :

  • Several messages are sent to an EIPAggregator pattern, which bufferize all incoming messages.
  • Trigger message is sent to EipAggregator.
  • EipAggregator sends an aggregated message to EipSPlitter.
  • EipSplitter splits the aggregated message back into multiple messages.
  • EipSPlitter sends the multiple messages to the operation AddIntegers on the service MathOperations.
  • MathOperations.AddIntegers processes the messages and send you the responses.
Full Size
A Gliffy Diagram named: Petals RMI-EIP-JSR181

What is EIP ?
A set of design patterns for enterprise application integration.

What is Agregator pattern ?
[TODO]

What is Splitter Pattern ?
[TODO]

Configure the Splitter

  1. Launch Petals Studio.
  2. Click File > New > Service-Unit Project.
  3. Select Use a Petals technical Service > EIP > Your_EIP_Version.
  4. Configure Splitter Service-Unit with following configuration:
    Parameter name
    Value
    JBI properties Note: EIP does not need a WSDL
    Interface namespace: http://test.petalslink.com
    InterfaceName: EipSplitterInterface
    Service Namespace: http://test.petalslink.com
    Service Name: EipSplitter
    End-point Name: EipSplitterEndpoint
    Project Name and Location  
    Project Name: su-EIP-EipSplitter-provide
    Chain calls (1)  
    Eip: Splitter
    Chain calls (2)
     
    Selected Pattern: splitter see below for configuration
  5. Click Add > Edit. It displays the window "EIP: Invoked Service 1".
  6. Click Select a service.
  7. Double click MathOperations implements MathOperations @ MathOperationsPort.
  8. Fill the following properties for Invoked Service 1:
    Service Identifiers Note: auto-configured
    Invocation Properties  
    Operation Namespace: http://test.petalslink.com
    Operation: AddIntegers
    Mep: InOut
    Routing Condition  
    XPath Condition //*[local-name()="AddIntegers"]
  9. Click Ok > Next > Finish.

Configure the Aggregator

  1. Create a New Service-Unit Project for EIP Technical Service with the following configuration:
Parameter name
Value
JBI propertie  
Interface namespace http://test.petalslink.com
InterfaceName EipAggregatorInterface
Service Namespace http://test.petalslink.com
Service Name EipAggregator
End-point Name EipAggregatorEndpoint
Project Name and Location  
Project Name su-EIP-EipAggregator-provide
Specific Component properties  
Eip Aggregator
Aggregator Correlation
boolean(/*[local-name()="AddIntegers"])
Service Parameters  
Service Parameters Select "su-EIP-EipSPlitter-provide
XPath Condition  
XPath Condition
boolean(/*[local-name()="AddIntegers"\]/*[local-name()="equals"])
Additional Parameters  
Operation Namespace http://test.petalslink.com
Operation AddIntegers
Mep InOut
CDK properties  
Validate WSDL false

Create and deploy an EIP Service Assembly

There is a tight-coupling between both EIP. Assembling them in one single Service Assembly (SA) can be a good idea (especially with EIP, which can chain lots of patterns, each requiring a different SU).

  1. Click File > New > Service Assembly Project.
    Service Assembly  
    Name: sa-Eip-AggregatorSplitter
    Artifact ID:
    sa-Eip-AggregatorSplitter
  2. Click Next.
  3. Check su-EIP-EipSplitter-provide and su-EIP-EipAggregator-provide.
  4. Click Finish.
  5. Fast-export the Service Assembly for Petals.
  6. Deploy Petals-SE-EIP in Petals ESB
  7. Deploy sa-Eip-AggregatorSplitter in Petals ESB.

Understand XPath expressions

What is XPath ?

Run this tutorial (takes ~30 min) for Xpath : http://www.w3schools.com/XPath/default.asp
Now try to understand the XPath expressions we used. If you use EIP later, it is essential to understand and be able to write XPath.

EIP Agregator conditions

  1. Elements which satisfy "aggregator-correlation" are aggregated
    <eip:aggregator-correlation>boolean(/*[local-name()="AddIntegers"])</eip:aggregator-correlation>

    Elements inside <AddIntegers> will be aggregated.

  1. When "test" is true, aggregated message is sent.
    <eip:test>boolean(/*[local-name()="AddIntegers"]/*[local-name()="equals"])</eip:test>

    When <AddIntegers> contains the <equals> element, the aggregated message is sent to the next service, and buffer cleared.

EIP Splitter conditions

  1. Elements which satisfy "test" are extracted and sent to the next service.
    <eip:test>//*[local-name()="AddIntegers"]</eip:test>

    <AddIntegers> elements are split and sent one by one.

Test the EIP chain

  1. Deploy the SA containing the SU su-jsr181-MathOperations-provide.
  2. Deploy the SA sa-Eip-AggregatorSplitter.
  3. Send messages from webconsole, with InOut MEP (message exchange pattern).
  4. Send the trigger message.
Message 1
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>1</integer1>
<integer2>2</integer2>
</AddIntegers>
Response message
<result xmlns="http://petals.ow2.org/petals-se-eip/aggregator">Aggregator: the content is buffered by the pattern</result>
Message 2
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>3</integer1>
<integer2>4</integer2>
</AddIntegers>
Message 3
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>5</integer1>
<integer2>6</integer2>
</AddIntegers>
Message 4 - Trigger
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<equals/>
</AddIntegers>
Response message
<result xmlns="http://petals.ow2.org/petals-se-eip/splitter">
<dlwmin:AddIntegersResponse xmlns:dlwmin="http://test.petalslink.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<returnMessage xmlns="">3</returnMessage>
</dlwmin:AddIntegersResponse>
<dlwmin:AddIntegersResponse xmlns:dlwmin="http://test.petalslink.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<returnMessage xmlns="">7</returnMessage>
</dlwmin:AddIntegersResponse>
<dlwmin:AddIntegersResponse xmlns:dlwmin="http://test.petalslink.com" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<returnMessage xmlns="">11</returnMessage>
</dlwmin:AddIntegersResponse>
</result>

More about orchestration

Look at other EIP patterns. Simple theory exercise: how would you do in this case....?

[TODO]

Other orchestration ways: BPEL, SCA, JSR181 or POJO. More info in this Orchestration Whitepaper.

EIP : Good performances. But complicated and a bit "dirty old way" (for example, do not use WSDL).
BPEL: Based on XML and WSDL. Standard. Quite complicated to learn. Poorer performances.
SCA: The simplest. Java code based on WSDL.
POJO or JSR181: Needs advanced Java programmation.
Custom JBI Component: Needs lot of skills. Best performances. Hard to maintain.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.