Deployment Options

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:

Simple Camel Deployment

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.

Simple Camel Deployment

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.

Example

The sample project below illustrates the simple deployment scenario. To Install it in your environment please follow the steps below:

  • Extract the content of the simple_deployment.zip file. The zip file contains two project:
  • To build order-processing-route-definition project, execute the following commands
  • 	> cd order-processing-route-definition
    	> mvn clean install
    
  • To build order-processing-web project, execute the following commands
  • 	> cd order-processing-web
    	> mvn clean package
    
  • to run the web console you can execute this command:
  • 	> mvn jetty:run
    

    Full ISB Deployment

    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.

    Full ISB Deployment

    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.

    Example

    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:

  • Security Execution Registration Service: Feed executions into RIMS back-office by inserting records into the trade bridge tables.
  • Security Order Registration Service: Feed orders into RIMS back-office by inserting records into the client order bridge tables.
  • Derivatives Allocation Registration Service. Feed allocation into ClearVision application by inserting the data into it's welcome table.
  • The architecture is as below:

    Example Full ISB Deployment

    the source code of the example is available for download. to install it in your environement please follow the instructions below:

  • Extract the content of the zip file. normally it should create a directory full_isb_deployment_example. under this directory you should be able to see rimsconnector-common, sar-service,sor-service,globaltrading-usecase,full-isb-deployment-example
  • To build rimsconnector-common project, execute the following commands
  • 	> cd rimsconnector-common
    	> mvn clean install
    
  • To build sar-service project, execute the following commands
  • 	> cd sar-service
    	> mvn clean install
    
  • To build sor-service project, execute the following commands
  • 	> cd sor-service
    	> mvn clean install
    
  • To build globaltrading-usecase project, execute the following commands
  • 	> cd globaltrading-usecase
    	> mvn clean install
    
  • To build full-isb-deployment-example project, execute the following commands
  • 	> cd full-isb-deployment-example
    	> mvn clean package
    
  • Create audit Trail in MYSQL:
  • 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
    
    

  • deploy the generated war file in webapp directory
  • Please note that you can use the junit tests, located in globaltrading-usecase/src/test

    Integrated Deployment

    If your application is using Spring framework, you can easily embed Camel. In fact, all you need to do is to:

  • Add Camel jar files in your classpath.
  • Define camelContext in a Spring configuration file.
  • Load Spring application when the application starts, and therefore Camel will be started.
  • 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.

    Embedding Camel in a Standard dynamic web project containing Stardust facet

    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.

    Integrated Camel Deployment

    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>
    

    Deploying the application into Tomcat

    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$ApplicationHolder 
    INFO: 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.

    Example

    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.

    Integrated Deployment Example

    To execute the example, please follow these steps:

  • Extract the content of integrated-deployment-scenario.zip. the zip file contains two projects:
  • Create audit Trail in MYSQL:
  • 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
    
    
  • Compile and package the claims-processing project by executing the command below. For More information please refer to section Create a new Camel project
    mvn clean package
  • Compile and package the claims-processing-web project by executing this command:
    mvn clean package
  • To run the example you need to deploy the generated war file into Tomcat. Once Tomcat started, Camel should be listening for file creation events in c:/data directory.
  • Create a file have the following content, and then move the file to c:/data. Camel will detect the file creation and it will process the file�s content. Process Instances should be started.
  • ###################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##########
    

    Deploying the application into JBOSS

    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>
    
    

    Deploying the application into Weblogic

    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.

    Distributed Deployment

    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.

    Distributed Deployment Example