Petals-SE-EIP

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

Changes (2)

View Page History

*Configuration of a Service Unit to provide a service (EIP)*
{loremipsum:5}

{table-plus}
|| Parameter\\ || Description\\ || Default\\ || Required by pattern\\ ||
| eip | The name of the pattern to execute : {{router}}\\ | \- | All |
| test | XPath condition applied on the message to choose the target service\\ | \- | aggregator\\
splitter\\
router\\
dynamic-router\\ |
| fault-to-exception\\ | if true, a fault received from the target service is transformed to an exception into the source exchange\\ | false | bridge\\
router\\
dynamic-router\\
routing-slip\\
dispatcher\\ |



{table-plus}

The EIP Component evaluates expressions on IN message from the source exchange. Conditions are valuated against the message until a {{true}} result. Then, the exchange is forwarded to the service referenced in the {{consumes}} section matching the position of the condition. If none of the conditions are true, the exchange is forwarded to the service referenced in the last {{consumes}} section (default).

An example of service unit configuration :
{code:lang=xml}<?xml version="1.0"?>

<!-- JBI descriptor for the PEtALS component "EIP" -->
<jbi:jbi version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jbi="http://java.sun.com/xml/ns/jbi"
xmlns:petalsCDK="http://petals.ow2.org/components/extensions/version-5"
xmlns:eip="http://petals.ow2.org/components/eip/version-2"
xmlns:test="http://petals.ow2.org/test">

<jbi:services binding-component="false">

<jbi:provides
interface-name="test:router"
service-name="test:routerService1"
endpoint-name="routerService1Endpoint">
<petalsCDK:wsdl xsi:nil="true" />
<eip:eip>router</eip:eip>
<eip:test>boolean(/*[local-name()='helloworld' and namespace-uri()='http://petals.ow2.org/test1'])</eip:test>
<eip:test>boolean(/*[local-name()='helloworld' and namespace-uri()='http://petals.ow2.org/test2'])</eip:test>
<eip:fault-to-exception>false</eip:fault-to-exception>
</jbi:provides>

<jbi:consumes interface-name="test:routerProvider"
service-name="test:routerProviderService1"
endpoint-name="routerProviderService1Endpoint">
<petalsCDK:mep>InOut</petalsCDK:mep>
<petalsCDK:operation xmlns:petals="http://org.ow2.petals">petals:operation</petalsCDK:operation>
</jbi:consumes>

<jbi:consumes interface-name="test:routerProvider"
service-name="test:routerProviderService2"
endpoint-name="routerProviderService2Endpoint">
<petalsCDK:mep>InOut</petalsCDK:mep>
<petalsCDK:operation xmlns:petals="http://org.ow2.petals">petals:operation</petalsCDK:operation>
</jbi:consumes>

<!-- default -->
<jbi:consumes interface-name="test:routerProvider"
service-name="test:routerProviderService3"
endpoint-name="routerProviderService3Endpoint">
<petalsCDK:mep>InOut</petalsCDK:mep>
<petalsCDK:operation xmlns:petals="http://org.ow2.petals">petals:operation</petalsCDK:operation>
</jbi:consumes>
</jbi:services>
</jbi:jbi>{code}
{note:title=Caution}{{{}consumes}} sections cardinality is the number of conditions plus 1 (the last one is the default service).{note}
{note:title=Caution}
the last {{consumes}} section is the default service to invoke if no condition has been fullfilled.
{note}

h3. Dynamic Router Pattern