| Operation: | AddIntegers |
| Mep: | InOut |
|| Routing Condition || ||
| XPath Condition | {noformat:nopanel=true}boolean(/*[local-name()="AddIntegers"]/*[local-name()="equals"]){noformat} |
# Click *Ok > Next > Finish*.
h2. Create and deploy an EIP Service Assembly
Beacause EipSplitter and EipAggregator are tight-coupled, they can be packaged in one Service Assembly, without loosing felxibility. This is especially adapted with EIP, which can chain lots of EIP Service-Units.
# Click *File > New > Service Assembly Project*.
|| Service Assembly || ||
| Name: | sa-Eip-AggregatorSplitter |
| Artifact ID: | sa-Eip-AggregatorSplitter |
# Click *Next*.
# Check *su-EIP-EipSplitter-provide* and *su-EIP-EipAggregator-provide*.
# Click *Finish*.
# *Fast-export* the Service Assembly for Petals.
# [Download|http://doc.petalslink.com/x/t4KK] Petals-SE-EIP.
# Deploy Petals-SE-EIP in Petals ESB.
# Deploy sa-Eip-AggregatorSplitter in Petals ESB.
h2. Understand XPath expressions
*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]
Look at XPath expressions used in EipSplitter and EipAggregator. Try to understand them. XPath is essential to use Petals-SE-EIP.
*EIP Agregator conditions:*
# Elements which satisfy "aggregator-correlation" are aggregated
{code:lang=xml}<eip:aggregator-correlation>boolean(/*[local-name()="AddIntegers"])</eip:aggregator-correlation>{code}
Elements inside <AddIntegers> will be aggregated.
# When "test" is true, aggregated message is sent.
{code:lang=xml}<eip:test>boolean(/*[local-name()="AddIntegers"]/*[local-name()="equals"])</eip:test>{code}
When <AddIntegers> contains the <equals> element, the aggregated message is sent to the next service, and buffer cleared.
*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}
<AddIntegers> elements are split and sent one by one.
h2. Test the EIP chain
# Check that sa-jsr181-MathOperations-provide (from last day tutorial) is deployed in Petals ESB. If not, deploy it.
# Deploy sa-Eip-AggregatorSplitter in Petals ESB.
# Go to *Webconsole > Server: 0 > Test > Send*
# Send following messages to *Endpoint* EipAggregatorEndpoint, with *MEP* InOut:
{code:lang=xml|title=Message 1}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>1</integer1>
<integer2>2</integer2>
</AddIntegers>
{code}
{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}
{code:lang=xml|title=Message 2}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>3</integer1>
<integer2>4</integer2>
</AddIntegers>
{code}
{code:lang=xml|title=Message 3}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>5</integer1>
<integer2>6</integer2>
</AddIntegers>
{code}
# Send trigger message:
{code:lang=xml|title=Message 4 - Trigger}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<equals/>
</AddIntegers>
{code}
{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 ?|TODO ?]