Petals Getting started - day 5 - EIP Orchestration

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (35)

View Page History
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.


{panel:title=Last tested with}
* Petals ESB 3.1
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.
{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 Agregator pattern ?*

*\[TODO\]*

*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.
*What is Splitter Pattern ?*

*\[TODO\]*


h2. Configure the Splitter

| Service Parameters | _Select "_{_}su-EIP-EipSPlitter-provide{_}_" _ | Auto-configuration |
|| XPath Condition || || ||
| XPath Condition | boolean(/\*\[local-name()="AddIntegers"\]/\*\[local-name()="equals"\]) boolean(/*\[local-name()="AddIntegers"\]/*\[local-name()="equals"\]) | |
|| Additional Parameters || || ||
| Operation Namespace | [http://test.petalslink.com] | |
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
|| Service Assembly || ||
| Name | sa-Eip-AggregatorSplitter |
# Add the two EIP Service-Units you created, and confirm
# Fast-export the Service Assembly for Petals.


h2. Review the chain
h2. Understand XPath expressions

*EIP Agregator*
*What is XPath ?*

Run this tutorial (takes \~30 min) for Xpath : [http://www.w3schools.com/XPath/default.asp|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.

{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.


*EIP Agregator conditions*
# Messages which satisfy "aggregator-correlation" are aggregated
{code:lang=xml}<eip:aggregator-correlation>boolean(/*[local-name()="AddIntegers"])</eip:aggregator-correlation>{code}
This means elements inside <AddIntegers> will be aggregated.

# Messages which satisfy "test" trigger the sending of aggregated buffer
{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*

*EIP Splitter conditions*
# Elements which satisfy "test" are extracted and sent to the next service.
{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&nbsp;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.
Send messages from webconsole, with InOut MEP (message exchange pattern), then send the trigger.

{code:lang=xml|title=Message 1|theme=Default}
{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...
Bufferize more messages:

{code:lange=xml|title=Message 2|theme=Default}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
{code}

Let us send the trigger message :
Trigger :
{code:lang=xml|title=Message 4 - Trigger|theme=Default}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
{code}

Now all messages are Messages processed by MathOperations :
{code:lang=xml|title=Response message|theme=Default}
<result xmlns="http://petals.ow2.org/petals-se-eip/splitter">



*Other orchestration ways: BPEL, SCA, JSR181 or POJO. More info in whitepaper*