{panel:title=Last tested with}
* Petals ESB 3.1
* Petals Studio 1.1.0
* Petals SE RMI 1.1.1
* Petals BC SOAP 4.0.2
* Petals Webconsole 2.0.3
* Tomcat 6.0.29
* JDK 6 update 20
* Petals SE Jsr181 1.1.2
*Added in this tutorial :*
* Petals SE EIP 2.4.3
{panel}
{info}This tutorial is based on [EIP Buffer complex use case|petalsesb:Bufferize operations with EIP].
{info}
h2. Definition of our integration process
Today you will bufferize messages, to process them all in one by _MathOperations_.
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.
{gliffy:space=petalsesb|page=Bufferize operations with EIP|name=Petals RMI-EIP-JSR181}
h2. Little bit of theory: EIP (Enterprise Integration Patterns) and XPath
*What is EIP ?*
A set of design patterns for enterprise application integration.
What is Agregator pattern ?
What is Splitter Pattern ?
*What is XPath ?*
Run this tutorial (takes \~30 min) for Xpath : [http://www.w3schools.com/XPath/default.asp]
We will use XPath to control conditions on EIP patterns.
h2. Configure the Splitter
# Create a new EIP Technical service with the following configuration:
# JBI properties of the configuration service:
## Interface namespace: *[http://test.petalslink.com|http://test.petalslink.com*]*
## InterfaceName: *EipSplitterInterface*
## Service Namespace: *[http://test.petalslink.com|http://test.petalslink.com*]*
## Service Name: *EipSplitter*
## End-point Name: *EipSplitterEndpoint*
# Project Name and Location:
## Project Name: su-EIP\-*EipSplitter*\-provide
# Specific Component properties:
## Eip: *Splitter*
# Service Parameters:
## Select _su-jsr181-MathOperations-provide_ for automatic configuration.
# XPath Condition:
## *//\[local-name()="AddIntegers"\]*
# Additional Parameters
## Operation Namespace: *[http://test.petalslink.com|http://test.petalslink.com*]*
## Operation: *AddIntegers*
## Mep: *InOut*
# CDK properties
## Validate WSDL: *false* (there is no wsdl)
h2. Configure the Aggregator
# Create a new EIP Technical service with the following configuration:
# JBI properties of the configuration service:
## 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: *Splitter*
## Aggregator Correlation: *boolean(/*\[local-name()="AddIntegers"\])*
# Service Parameters:
## Select _su-EIP-EipSPlitter-provide_ for automatic configuration.
# XPath Condition:
## *boolean(/*\[local-name()="AddIntegers"\]/*\[local-name()="equals"\])*
# Additional Parameters
## Operation Namespace: *[http://test.petalslink.com]*
## Operation: *AnyOperationName* (since EipSplitter does not have an operation name)
## Mep: *InOut*
# CDK properties
## Validate WSDL: *false* (there is no wsdl)
h2. Create and deploy an EIP Service Assembly
There is a tight-coupling between both EIP. Assembling them in one single SA can be a good idea (especially with EIP, which can chain lots of patterns, each requiring a different SU).
# Create a new Service Assembly.
## Name: *sa-Eip-AggregatorSplitter*
# Add the two EIP Service-Units you created, and confirm
# Fast-export the Service Assembly for Petals.
# Deploy in Petals ESB.
h2. Review the chain
*EIP Agregator*
{code:lang=xml}<eip:aggregator-correlation>boolean(/*[local-name()="AddIntegers"])</eip:aggregator-correlation>{code}
Messages which satisfy "aggregator-correlation" will be aggregated. <=> Elements inside <AddIntegers> will be aggregated.
{code:lang=xml}<eip:test>boolean(/*[local-name()="AddIntegers"]/*[local-name()="equals"])</eip:test>{code}
Messages which satisfy "test" act as the, to send the aggregated buffer. <=> If <AddIntegers> contains <equals> element, aggregated message is sent to the next service and buffer cleared.
*EIP Splitter*
{code:lang=xml}<eip:test>//*[local-name()="AddIntegers"]</eip:test>{code}
Elements which satisfy "test" are extracted and sent to the next service. <=> <AddIntegers> elements are split and each one is sent in one message.
h2. Test the EIP chain
Deploy the SA containing the SU su-jsr181-MathOperations-provide. Deploy the SA sa-Eip-AggregatorSplitter.
Then we can send test messages from the webconsole. For example, we will send three messages, with InOut MEP (message exchange pattern), and then send the trigger message.
{code:lang=xml|title=Message 1|theme=Default}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>1</integer1>
<integer2>2</integer2>
</AddIntegers>
{code}
When everything is fine, you get this response, just saying the message was buffered :
{code:lang=xml|title=Response message|theme=Default}
<result xmlns="http://petals.ow2.org/petals-se-eip/aggregator">Aggregator: the content is buffered by the pattern</result>
{code}
We can continue to bufferize messages...
{code:lange=xml|title=Message 2|theme=Default}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>3</integer1>
<integer2>4</integer2>
</AddIntegers>
{code}
{code:lang=xml|title=Message 3|theme=Default}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>5</integer1>
<integer2>6</integer2>
</AddIntegers>
{code}
Let us send the trigger message :
{code:lang=xml|title=Message 4 - Trigger|theme=Default}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<equals/>
</AddIntegers>
{code}
Now all messages are processed by MathOperations :
{code:lang=xml|title=Response message|theme=Default}
<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>
{code}
h2. 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 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.
* Petals ESB 3.1
* Petals Studio 1.1.0
* Petals SE RMI 1.1.1
* Petals BC SOAP 4.0.2
* Petals Webconsole 2.0.3
* Tomcat 6.0.29
* JDK 6 update 20
* Petals SE Jsr181 1.1.2
*Added in this tutorial :*
* Petals SE EIP 2.4.3
{panel}
{info}This tutorial is based on [EIP Buffer complex use case|petalsesb:Bufferize operations with EIP].
{info}
h2. Definition of our integration process
Today you will bufferize messages, to process them all in one by _MathOperations_.
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.
{gliffy:space=petalsesb|page=Bufferize operations with EIP|name=Petals RMI-EIP-JSR181}
h2. Little bit of theory: EIP (Enterprise Integration Patterns) and XPath
*What is EIP ?*
A set of design patterns for enterprise application integration.
What is Agregator pattern ?
What is Splitter Pattern ?
*What is XPath ?*
Run this tutorial (takes \~30 min) for Xpath : [http://www.w3schools.com/XPath/default.asp]
We will use XPath to control conditions on EIP patterns.
h2. Configure the Splitter
# Create a new EIP Technical service with the following configuration:
# JBI properties of the configuration service:
## Interface namespace: *[http://test.petalslink.com|http://test.petalslink.com*]*
## InterfaceName: *EipSplitterInterface*
## Service Namespace: *[http://test.petalslink.com|http://test.petalslink.com*]*
## Service Name: *EipSplitter*
## End-point Name: *EipSplitterEndpoint*
# Project Name and Location:
## Project Name: su-EIP\-*EipSplitter*\-provide
# Specific Component properties:
## Eip: *Splitter*
# Service Parameters:
## Select _su-jsr181-MathOperations-provide_ for automatic configuration.
# XPath Condition:
## *//\[local-name()="AddIntegers"\]*
# Additional Parameters
## Operation Namespace: *[http://test.petalslink.com|http://test.petalslink.com*]*
## Operation: *AddIntegers*
## Mep: *InOut*
# CDK properties
## Validate WSDL: *false* (there is no wsdl)
h2. Configure the Aggregator
# Create a new EIP Technical service with the following configuration:
# JBI properties of the configuration service:
## 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: *Splitter*
## Aggregator Correlation: *boolean(/*\[local-name()="AddIntegers"\])*
# Service Parameters:
## Select _su-EIP-EipSPlitter-provide_ for automatic configuration.
# XPath Condition:
## *boolean(/*\[local-name()="AddIntegers"\]/*\[local-name()="equals"\])*
# Additional Parameters
## Operation Namespace: *[http://test.petalslink.com]*
## Operation: *AnyOperationName* (since EipSplitter does not have an operation name)
## Mep: *InOut*
# CDK properties
## Validate WSDL: *false* (there is no wsdl)
h2. Create and deploy an EIP Service Assembly
There is a tight-coupling between both EIP. Assembling them in one single SA can be a good idea (especially with EIP, which can chain lots of patterns, each requiring a different SU).
# Create a new Service Assembly.
## Name: *sa-Eip-AggregatorSplitter*
# Add the two EIP Service-Units you created, and confirm
# Fast-export the Service Assembly for Petals.
# Deploy in Petals ESB.
h2. Review the chain
*EIP Agregator*
{code:lang=xml}<eip:aggregator-correlation>boolean(/*[local-name()="AddIntegers"])</eip:aggregator-correlation>{code}
Messages which satisfy "aggregator-correlation" will be aggregated. <=> Elements inside <AddIntegers> will be aggregated.
{code:lang=xml}<eip:test>boolean(/*[local-name()="AddIntegers"]/*[local-name()="equals"])</eip:test>{code}
Messages which satisfy "test" act as the, to send the aggregated buffer. <=> If <AddIntegers> contains <equals> element, aggregated message is sent to the next service and buffer cleared.
*EIP Splitter*
{code:lang=xml}<eip:test>//*[local-name()="AddIntegers"]</eip:test>{code}
Elements which satisfy "test" are extracted and sent to the next service. <=> <AddIntegers> elements are split and each one is sent in one message.
h2. Test the EIP chain
Deploy the SA containing the SU su-jsr181-MathOperations-provide. Deploy the SA sa-Eip-AggregatorSplitter.
Then we can send test messages from the webconsole. For example, we will send three messages, with InOut MEP (message exchange pattern), and then send the trigger message.
{code:lang=xml|title=Message 1|theme=Default}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>1</integer1>
<integer2>2</integer2>
</AddIntegers>
{code}
When everything is fine, you get this response, just saying the message was buffered :
{code:lang=xml|title=Response message|theme=Default}
<result xmlns="http://petals.ow2.org/petals-se-eip/aggregator">Aggregator: the content is buffered by the pattern</result>
{code}
We can continue to bufferize messages...
{code:lange=xml|title=Message 2|theme=Default}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>3</integer1>
<integer2>4</integer2>
</AddIntegers>
{code}
{code:lang=xml|title=Message 3|theme=Default}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>5</integer1>
<integer2>6</integer2>
</AddIntegers>
{code}
Let us send the trigger message :
{code:lang=xml|title=Message 4 - Trigger|theme=Default}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<equals/>
</AddIntegers>
{code}
Now all messages are processed by MathOperations :
{code:lang=xml|title=Response message|theme=Default}
<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>
{code}
h2. 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 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.