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 (59)

View Page History

*What is Agregator pattern ?*
[TODO]



*What is Splitter Pattern ?*
[TODO]
Read [EIP Aggregator|http://doc.petalslink.com/display/petalscomponents/Petals-SE-EIP+2.5#Petals-SE-EIP2.5-AggregatorPattern] and [EIP SPlitter|http://doc.petalslink.com/display/petalscomponents/Petals-SE-EIP+2.5#Petals-SE-EIP2.5-SplitterPattern] documentation to understand those patterns.

h2. Configure EIP Splitter


h2. Configure the Splitter


# Launch *Petals Studio*.
# Click *File > New > Service-Unit Project*.
# Click *Select a service*.
# Double click *MathOperations implements MathOperations @ MathOperationsPort*.
# Fill the following properties for *Invoked Service 1*:
|| Service Identifiers || _Note: auto-configured_ ||
|| Invocation Properties || ||
# Click *Ok > Next > Finish*.

h2. Configure the EIP Aggregator

# Create a another *New Service-Unit Project* for *EIP Technical Service* with the following configuration:

|| Parameter name \\ || Value \\ ||
|| JBI propertie || ||
| Interface namespace Namespace: | [http://test.petalslink.com] |
| InterfaceName | EipAggregatorInterface |
| Interface Name: | 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 || ||
|| Chain calls (1) || ||
| Eip: | Aggregator |
| Aggregator Correlation \\ Correlation: | boolean(/*\[local-name()="AddIntegers"\]) |
|| Service Parameters || ||
| Service Parameters | _Select "_{_}su-EIP-EipSPlitter-provide{_}_" _ |
| Service Parameters | see below for configuration |
# Click *Add > Edit*. It displays the window "EIP: Invoked Service 1".
# Click *Select a service*.
# Double click *EipSplitter implements EipSplitterInterface @ EipSplitterEndpoint*.
# Fill the following properties for *Invoked Service 1*:
|| Service Identifiers || _Note: auto-configured_ ||
|| Invocation Properties || ||
| Operation Namespace: | [http://test.petalslink.com|http://test.petalslink.com/] |
| Operation: | AddIntegers |
| Mep: | InOut |
|| XPath Routing Condition || ||
| XPath Condition | {noformat:nopanel=true}boolean(/*[local-name()="AddIntegers"\]/*[local-name()="equals"]){noformat} |
|| Additional Parameters || ||
| Operation Namespace | [http://test.petalslink.com] |
| Operation | AddIntegers |
| Mep | InOut |
|| CDK properties || ||
| Validate WSDL | false |
# Click *Ok > Next > Finish*.


h2. 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).
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.


*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.
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.
h2. Test the EIP chain

# Deploy the SA containing the SU su-jsr181-MathOperations-provide.
# Deploy the SA&nbsp;sa-Eip-AggregatorSplitter.
# Send messages from webconsole, with InOut MEP (message exchange pattern).
# Send the trigger message.

{code:lang=xml|title=Message 1|theme=Default}
# 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>
</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:lange=xml|title=Message 2|theme=Default}
{code:lange=xml|title=Message 2}
<AddIntegers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<integer1>3</integer1>
</AddIntegers>
{code}

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

# Send trigger message:
{code:lang=xml|title=Message 4 - Trigger|theme=Default}
<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">
h2. More about orchestration

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

[TODO]
*Orchestration alternatives*
You can orchestrate services in Petals with BPEL, SCA, JSR181, EIP or POJO. Read this *[Orchestration Whitepaper|http://www.petalslink.com/fr/forms/orchestration-de-processus-quelle-technologie-privilegier]* if you are interested.

Summary:
- 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.

Finished !
Bravo, you successfully ran the Petals Getting Started Guide.

Want to know more ?
- Tell me what additional tutorial you would like.
- Ask me for a free advise on your project architecture. I will pass it to our architects so they can have a look. This might give you new insights.
- Trainings gives advanced knowledge on Petals ESB. They talk more about SOA, and real project problems.

For all this, just contact me !
mathieu.lebreton@petalslink.com









*Other orchestration ways: BPEL, SCA, JSR181 or POJO. More info in this* *[Orchestration Whitepaper|http://www.petalslink.com/fr/forms/orchestration-de-processus-quelle-technologie-privilegier]**.*

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.