View Source

{section}
{column}

{multi-excerpt-include:Petals-SE-Camel\|name=features\|nopanel=true}
{column}

{column:width=40%}
{panel:title=Table of contents}{toc:outline=true}{panel}
{panel:title=Contributors}{contributors:order=name\|mode=list\|showAnonymous=true\|showCount=true\|showLastTime=true}{panel}
{column}
{section}

h1. Introduction

This implementation of the SE Camel uses Camel version 2.14.X.

Routes can be defined using any of the JVM based DSL, as well as using the XML notation.
For each *provides* section, one or many routes can be activated when a message is received.
Each route can call any service declared in a *consumes* section.

{tip}
The terminology used by Camel is apparently counter-intuitive to the one used in JBI terminology: a camel route consumes a service while an SU provides this same service.
This is because from the route point of view, messages arriving to the provided service are then consumed by the rule.
{tip}

We show in the next section a general overview of a typical Service Unit.

h1. Overview of a Camel Service Unit at Implementation Time

h2. Service Unit Content

A Camel SU typically contains the following elements:

{noformat}
su-camel-ServiceName-provide.zip
+ META-INF
- jbi.xml
+ service.wsdl (one or several)
+ route-implementation.jar (none, one or several)
+ route-implementation.xml (none, one or several)
{noformat}

There must be at least one route implementation, in a jar file or an xml file ; a WSDL description for every service declared in the JBI descriptor and of course a JBI descriptor.

h2. A Camel Route

Here is an example of a Camel route defined in XML:

{code:lang=xml}
<route id="NormalizeMessageData">
<from uri="petals:incomingOrders" />
<convertBodyTo type="java.lang.String" />
<choice>
<when>
<simple>${body} contains '?xml'</simple>
<unmarshal>
<jaxb contextPath="org.fusesource.camel" />
</unmarshal>
<to uri="petals:orders" />
</when>
<otherwise>
<unmarshal>
<bindy packages="org.fusesource.camel" type="Csv" />
</unmarshal>
<to uri="petals:orders2" />
</otherwise>
</choice>
</route>
{code}

{color:red}{*}TODO. make that a real example, this is copied from an example on the web...*{color}

The only specificity of this route are the URIs used to identify the services consumed by the route (*from* element) and to which messages are then sent (*to* element).
The protocol reserved to petals is *petals* and it is followed by *:* and then the unique id identifying a service, and optionally an operation to be invoked.

One can refer to provides services with from() and to provides and consumes services with to().
In the case of a provides service called with to(), the message will stay inside the SU and won't go back through Petals.

h2. JBI Descriptor

The JBI descriptor contains:
* The services that are provided by this SU and for which routes will handle messages, and
* The services consumed by this SU and that will be callable from the route.

In order to identify a service, each of the, provided or consumed, service must have a unique id.
Of course, a provided service will be only usable by *from* elements and consumed services by *to* elements.

{code:lang=xml}
<?xml version="1.0" encoding="UTF-8"?>
<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:helloworld="http://petals.ow2.org/helloworld"
xmlns:camel="http://petals.ow2.org/components/camel/version-1">

<jbi:services binding-component="false">
<jbi:provides
interface-name="helloworld:Helloworld"
service-name="helloworld:HelloworldService"
endpoint-name="HelloworldEndpoint">
<petalsCDK:wsdl>service.wsdl</petalsCDK:wsdl>
<camel:service-id>incomingOrders</camel:class>
</jbi:provides>
<jbi:consumes
interface-name="sample:calledInterface1"
service-name="sample:calledService1"
endpoint-name="calledEndpoint1">
<camel:service-id>orders</camel:class>
</jbi:consumes>
<jbi:consumes
interface-name="sample:calledInterface2"
service-name="sample:calledService2"
endpoint-name="calledEndpoint2">
<camel:service-id>orders2</camel:class>
</jbi:consumes>
<camel:routes>
<camel:xml-route>route-implementation.xml</camel:xml-route>
<camel:jvm-route>org.example.RouteImplementation</camel:jvm-route>
<camel:jvm-route>org.example.RouteImplementation2</camel:jvm-route>
</camel:routes>
</jbi:services>
</jbi:jbi>
{code}

{color:red}{*}TODO. make that a real example, this is copied from jsi181 with bits of EIP and a mock-up for camel:routes...*{color}

h3. Provides Section

{include:0 CDK SU Provide Configuration}

{center}{*}Configuration of a Service Unit to provide a service (Camel)*{center}
{table-plus}



|| Parameter || Description || Default || Required ||
| service-id | The unique id in the SU for the provided service. It will be visible from the route to refer to this service. | {center}\-{center} | {center}Yes{center} |
{table-plus}

h3. Consumes Section

{include:0 JBI SU Consume Configuration}

{center}{*}Configuration of a Service Unit to consume a service (Camel)*{center}
{table-plus}



|| Parameter || Description || Default || Required ||
| service-id | The unique id in the SU for the consumed service. It will be visible from the route to refer to this service. | {center}\-{center} | {center}Yes{center} |
{table-plus}

h3. Services Section

{color:red}{*}TODO. Not sure this should be in the service section... this seems to be the natural place for it to be because it is not bound to a specific service but to the whole SU...*{color}
{color:red}{*}TODO. Is there an include also with a table for the whole services section?*{color}

h1. Overview of a Camel Service Unit at Runtime

Camel routes are instantiated in a Camel context.
With the SE Camel, for every SU, there is one Camel context created containing all the routes described in the SU.

When a message arrives on a provided service, it is dispatched to all the routes that consumes the service.
There is no guarantee of order of the route executed nor guarantee of either parallel or sequential execution of the routes.

{color:red}{*}TODO. This is of course open to discussion.*{color}