Camel is described as a lightweight and embeddable integration framework. This means that it supports more deployment strategies and flexibility than traditional ESBs and application servers. In fact, it�s possible to run Camel standalone or in any container or embedded within your application. In this chapter we will present the following deployment scenarios:
An easy way to integrate two solution is to use Apache Camel. It offers higher-level abstractions that allow you to interact with various systems using the same API regardless of the protocol or data type the systems are using. By using Camel web console you will be able to start/stop routes, update route definition, add routes,... To create a new Camel project with webconsole please refer to Create a new Project chapter.

When the command below is executed, Maven will generate a war file that you can deploy in any J2EE web container.
mvn package
The generated war file can be then depoyed into a J2EE web container. You just need to make sure that all your project dependencies are defined in pom.xml file.
The sample project below illustrates the simple deployment scenario. To Install it in your environment please follow the steps below:
> cd order-processing-route-definition > mvn clean install
> cd order-processing-web > mvn clean package
> mvn jetty:run
In this scenario, a combination of Apache Camel and Stardust is used to connect solutions. The solutions and Apache Camel may be deployed on a different physically disjoint Runtime Environement.

The services of the solutions are exposed as Endpoints in Camel routes. Routes can be defined between those in Camel also using Stardust for more complex Routes, keeping state of routing in Stardust and processing exception with interactive workflow.
In this example, Stardust will be used to orchestrate the insertion of orders and executions into Sungard Global trading middle and back offices. FIX messages are received in a jms queue. Each fix message will be parsed by the ESB using the QuickFIX/J. The ESB then call Stardust service orchestration process by passing the FIX object model. If a FIX message is not valid, it will be rejected by the ESB. The services used in this case are presented below:
The architecture is as below:

the source code of the example is available for download. to install it in your environement please follow the instructions below:
> cd rimsconnector-common > mvn clean install
> cd sar-service > mvn clean install
> cd sor-service > mvn clean install
> cd globaltrading-usecase > mvn clean install
> cd full-isb-deployment-example > mvn clean package
Please note that MySQL 5.0.x is the latest supported version.
Go to your local Stardust installation and create the schema file: $> cd\ $> bin\sysconsole -dbtype MYSQL ddl -file schema_mysql.sql Setup MySQL: $> mysql -h localhost -u root -p ... mysql> create database claims-processing; mysql> GRANT ALL PRIVILEGES ON ipp_esb.* TO 'carnot'@'localhost' IDENTIFIED BY 'ag' WITH GRANT OPTION; mysql> quit; Import the schema: $> mysql -h localhost -u root -p ipp_esb < schema_mysql.sql
Please note that you can use the junit tests, located in globaltrading-usecase/src/test
If your application is using Spring framework, you can easily embed Camel. In fact, all you need to do is to:
Using Camel's Spring DSL enables you to specify routing rules in
an XML configuration file. In addition to these aspects, you can take
advantage of the generic Spring mechanisms for configuring and linking
together Java objects within the Spring container. The Spring container
is responsible for managing the lifecycle of org.apache.camel.builder.RouteBuilder
objects. The Spring container finds and instantiates the org.apache.camel.builder.RouteBuilder
objects after it starts.
In an integrated deployment scenario a single Stardust deployment may be used for ESB and BPM functionality. By embedding Camel in a web application you can benefit from all the transports, routes, EIPs that Camel offers. You need to make sure that all JARs are packaged in the WAR file.

The Camel instance embedded in your application will be
bootstrapped by Spring. More specifically by the org.springframework.web.context.ContextLoaderListener
class defined in your web.xml file. This context listener
will take care of starting and stopping camelContext properly when the
application is stared or stopped. To specify the name of your Spring
context file, you can add the following configuration in your
application's web.xml file.
<context-param> <param-name>contextConfigLocation</param-name> <param-value>WEB-INF/config/ipp/spring/*-context.xml,classpath*:META-INF/spring/*-context.xml</param-value> </context-param>
The application is packaged as a WAR file. You can run the command below in your Maven project root directory which creates the WAR file in the target directory. If you are not using Maven, you have to ensure that all the dependencies are in the generated war file. Now, we assume that you generated a war file. At this stage, you need to go throw the steps required to deploy Stardust within a Tomcat servlet engine please refer to Deployment and Configuration chapter of Stardust Help.
mvn package
[main] INFO ContextLoader - Root WebApplicationContext: initialization started [main] INFO XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Fri Jun 03 08:48:25 GMT+01 [main] INFO XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/application [main] INFO CamelNamespaceHandler - OSGi environment not detected. � [main] INFO DefaultCamelContext - Apache Camel 2.5.0 (CamelContext: camel-1) is starting [main] INFO DefaultCamelContext - JMX enabled. Using ManagedManagementStrategy. [main] INFO FileEndpoint - Endpoint is configured with noop=true so forcing endpoint to be idempotent as well [main] INFO FileEndpoint - Using default memory based idempotent repository with cache max size: 1000 [main] INFO DefaultCamelContext - Route: route1 started and consuming from: Endpoint[file://src/data?noop=true] [main] INFO TransportConnector - Connector vm://localhost Started [main] INFO DefaultCamelContext - Route: route2 started and consuming from: Endpoint[activemq://personnel.records [main] INFO DefaultCamelContext - Total 2 routes, of which 2 is started. [main] INFO DefaultCamelContext - Apache Camel 2.5.0 (CamelContext: camel-1) started in 0.974 seconds [main] INFO ContextLoader - Root WebApplicationContext: initialization completed in 13240 ms INFO: Using default applicationContext Jun 3, 2011 8:48:39 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate INFO: Initiating Jersey application, version 'Jersey: 1.4 09/11/2010 10:30 PM' Jun 3, 2011 8:48:39 AM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate INFO: Adding the following classes declared in META-INF/services/jersey-server-components to the resource configuration: class org.fusesource.scalate.rest.NodeWriter class org.fusesource.scalate.rest.TransformerWriter class org.fusesource.scalate.rest.ViewWriter class org.fusesource.scalate.jersey.ScalateTemplateProcessor class org.fusesource.scalate.jersey.ScalateTemplateProvider Jun 3, 2011 8:48:39 AM com.sun.jersey.api.core.PackagesResourceConfig init INFO: Scanning for root resource and provider classes in the packages: org.apache.camel.web Jun 3, 2011 8:48:39 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses INFO: Root resource classes found: class org.apache.camel.web.resources.CamelContextResource Jun 3, 2011 8:48:39 AM com.sun.jersey.api.core.ScanningResourceConfig logClasses INFO: Provider classes found: class org.apache.camel.web.util.JAXBMarshallerResolver class org.apache.camel.web.util.JAXBContextResolverOSGI class org.apache.camel.web.util.JAXBContextResolver Jun 3, 2011 8:48:39 AM com.sun.jersey.server.impl.application.DeferredResourceConfig$ApplicationHolderINFO: Instantiated the Application class org.apache.camel.web.util.CamelResourceConfig ... Jun 3, 2011 8:48:42 AM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8080 Jun 3, 2011 8:48:43 AM org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 Jun 3, 2011 8:48:43 AM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/91 config=null Jun 3, 2011 8:48:43 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 25924 ms
Embedding Camel in a web application is a powerful way to deploy Camel application. In fact, using this deployment model allows you to use the management and monitoring capabilities provided by the servlet container.
A fictional company Claims Ltd. would like you to set up an environment to demonstrate the capabilities of a BPM system for claims processing. In this example, claims are transmitted by using CSV files to the BPM system. The solution will detect and consume incoming claims files and automatically start claims process instances in the BPM system.

To execute the example, please follow these steps:
Please note that MySQL 5.0.x is the latest supported version.
Go to your local Stardust installation and create the schema file: $> cd\ $> bin\sysconsole -dbtype MYSQL ddl -file schema_mysql.sql Setup MySQL: $> mysql -h localhost -u root -p ... mysql> create database claims-processing; mysql> GRANT ALL PRIVILEGES ON claims-processing.* TO 'claims'@'localhost' IDENTIFIED BY 'claims' WITH GRANT OPTION; mysql> quit; Import the schema: $> mysql -h localhost -u root -p claims-processing < schema_mysql.sql
mvn clean package
mvn clean package
###################AUTO INTERFACE 3RD PARTY ACH##### AUTO,0,-1,CASH,THD PT ACH,CASH,THD PT ACH,,,,,,PROCESS,TEXT,T,TEXT,*.SUNGARD.P1.*ACH*.*REPT,-1,-1 AUTO,-1,DATE_MMDDYY,1,98 AUTO,1,POWIMAGE,RPT INFO TA,RPTNBR,10,s,n,,2,130 AUTO,2,POWIMAGE,RPT INFO TA,CONBR,3,s,n,,1,4 AUTO,-4,GROUP,RPT INFO TA,N #############################END OF AUTO INTERFACE FILE##########
If you intend to deploy your application within JBOSS Application server, you need to use the Camel JBoss component which will be responsible for classloading. It�s just a matter of defining a Spring bean with the JBoss class resolver
<bean id="jbossResolver" class="org.apache.camel.jboss.JBossPackageScanClassResolver"/>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="seda:start"/>
<to uri="mock:result"/>
</route>
</camelContext>
The Camel-jboss component is available under the LGPL licence. To be able to use this component add the following configuration in your pom.xml file
<dependencies>
<dependency>
<groupId>org.apache.camel.extra</groupId>
<artifactId>camel-jboss</artifactId>
<version>${camel-version}</version>
</dependency>
�
</dependencies>
�
<repositories>
<repository>
<id>camel-extra-release</id>
<name>Camel Extra Maven repository of releases</name>
<url>http://camel-extra.googlecode.com/svn/maven2/releases</url>
</repository>
</repositories>
If your web application is already deployed in Oracle Weblogic, you can embed Camel in it. You need just to ensure that all the dependencies are contained in the deployed war file. The embedded Camel instance will be bootstrapped by Spring.
This scenario demonstrates how multiple deployments of Stardust may exist in separate runtime environments. Some of them concerned with the BPMS role of Stardust, some with the use of Stardust as part of ISB to accomplish ESB tasks.
