|
Key
This line was removed.
This word was removed. This word was added.
This line was added.
|
Changes (14)
View Page HistoryRoutes can be defined using any of the JVM based DSL, as well as using the XML notation.
A Camel route always starts with a *from* declaration, a consumer, and often ends with one or many *to* declaration, producers.
A Camel route always starts with a *from* declaration, a consumer, and often ends with one or many *to* declaration, producers.
Consumers and producers refers to service external to Camel using an URI: Petals has its own URI scheme.
Consumers and producers refers to service external to Camel using an URI: Petals services have their own URI scheme identified with *petals*.
For each *provides* section, exactly one route must be present and will be activated when a message is received.
h1. Overview of a Camel Service Unit at Implementation Time
h2. Maven Project
When developing with Maven, the pom.xml file must contains the following kind of declarations:
{code:lang=xml}
<!-- ... -->
<!-- We are producing a service unit -->
<groupId>my.group</groupId>
<artifactId>my-service-unit</artifactId>
<version>1.0.0</version>
<packaging>jbi-service-unit</packaging>
<!-- ... -->
<dependencies>
<!-- First a jbi-component dependency to the component (note that it won't provide anything in the classpath!) -->
<dependency>
<groupId>org.ow2.petals</groupId>
<artifactId>petals-se-camel</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>jbi-component</type>
</dependency>
<!-- Then a dependency to camel, only if you plan to implement routes in Java -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.15.0</version>
<scope>provided</scope>
</dependency>
<!-- Maybe other dependencies if you relies on other camel extensions (for xml and java routes) -->
</dependencies>
<!-- ... -->
<build>
<!-- Finally the petals maven plugins to generate JBI zip files -->
<plugins>
<plugin>
<groupId>org.ow2.petals</groupId>
<artifactId>maven-petals-plugin</artifactId>
</plugin>
</plugins>
</build>
<!-- ... -->
{code}
The project structure will follow typical maven projects :
{noformat}
my-service-unit/
+ pom.xml
+ src/
+ main/
+ jbi/
+ jbi.xml
+ service.wsdl (none, one or several)
+ java/.../MyRoutes.java (none, one or several)
+ resources/myroutes.xml (none, one or several)
{noformat}
On top of the typical pom.xml, there must be at least one route implementation per operation of the provides, in a jar file or an xml file, a WSDL description for every provides service of the JBI descriptor and of course a JBI descriptor.
When developing with Maven, the pom.xml file must contains the following kind of declarations:
{code:lang=xml}
<!-- ... -->
<!-- We are producing a service unit -->
<groupId>my.group</groupId>
<artifactId>my-service-unit</artifactId>
<version>1.0.0</version>
<packaging>jbi-service-unit</packaging>
<!-- ... -->
<dependencies>
<!-- First a jbi-component dependency to the component (note that it won't provide anything in the classpath!) -->
<dependency>
<groupId>org.ow2.petals</groupId>
<artifactId>petals-se-camel</artifactId>
<version>1.0.0-SNAPSHOT</version>
<type>jbi-component</type>
</dependency>
<!-- Then a dependency to camel, only if you plan to implement routes in Java -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.15.0</version>
<scope>provided</scope>
</dependency>
<!-- Maybe other dependencies if you relies on other camel extensions (for xml and java routes) -->
</dependencies>
<!-- ... -->
<build>
<!-- Finally the petals maven plugins to generate JBI zip files -->
<plugins>
<plugin>
<groupId>org.ow2.petals</groupId>
<artifactId>maven-petals-plugin</artifactId>
</plugin>
</plugins>
</build>
<!-- ... -->
{code}
The project structure will follow typical maven projects :
{noformat}
my-service-unit/
+ pom.xml
+ src/
+ main/
+ jbi/
+ jbi.xml
+ service.wsdl (none, one or several)
+ java/.../MyRoutes.java (none, one or several)
+ resources/myroutes.xml (none, one or several)
{noformat}
On top of the typical pom.xml, there must be at least one route implementation per operation of the provides, in a jar file or an xml file, a WSDL description for every provides service of the JBI descriptor and of course a JBI descriptor.
h2. Service Unit Content
A Camel SU typically contains the following elements:
A Camel SU generated from the previous Maven projects, named my-service-unit-1.0.0.zip will contains the following elements:
{noformat}
su-camel-ServiceName-provide.zip my-service-unit-1.0.0.zip
+ META-INF/
+ META-INF jbi.xml
- jbi.xml
+ service.wsdl (one or several)
+ service.wsdl (one or several)
+ route-implementation.jar service.wsdl (none, one or several)
+ route-implementation.xml (none, one or several)
+ my-service-unit-1.0.0.jar
{noformat}
There must be at least one route implementation per operation of the provides, in a jar file or an xml file, a WSDL description for every provides service of the JBI descriptor and of course a JBI descriptor.
Note that the jar is the generated Jar Maven artefact, and it is included in the generated Zip artefact by the petals maven plugin.
h2. A Camel Route