5.7. Red Hat JBoss Data Grid and Red Hat JBoss EAP

5.7.1. Installing camel-jbossdatagrid for Red Hat JBoss Enterprise Application Platform

Red Hat JBoss Enterprise Application Platform 6 (JBoss EAP 6) is a middleware platform built on open standards and compliant with the Java Enterprise Edition 6 specification.
As Camel is only supported through Red Hat JBoss Fuse valid entitlements for all of the following products will be necessary:
  • Red Hat JBoss EAP
  • Red Hat JBoss Fuse
  • Red Hat JBoss Data Grid

Note

Entitlement to Red Hat JBoss Fuse Service Works includes entitlements to Red Hat JBoss EAP and Red Hat JBoss Fuse.
The following variables are used instead of specific version numbers in the installation procedures below:
  • jdg.version - the latest version of Red Hat JBoss Data Grid
    fuse.version - the latest version of Red Hat JBoss Fuse
  • infinispan.version - the version of Infinispan that is included in the latest version of Red Hat JBoss Data Grid
  • camel.version - the version of Apache Camel that is included in the latest version of Red Hat JBoss Fuse
For more information on tested integrations for camel-jbossdatagrid, please refer to https://access.redhat.com/articles/115883.

Procedure 5.3. Installing JBoss Data Grid

  • For information about installing JBoss Data Grid, see Part II, “Download and Install Red Hat JBoss Data Grid”. Only the following JBoss Data Grid components are required to run the camel component in JBoss EAP:
    • JBoss Data Grid Maven repository.
    • The JBoss Data Grid Server package (to use the Hot Rod client).
The camel-jbossdatagrid library is also available in a separate distribution called jboss-datagrid-${jdg.version}-camel-library.

Procedure 5.4. Installing JBoss EAP

  1. Before attempting to install and use Red Hat JBoss EAP ensure your system meets the minimum requirements as documented in Red Hat JBoss EAP Installation Guide.
  2. Unpacking the Archive

    Red Hat JBoss EAP is installed by unpacking an archive on a system, as JBoss EAP is packaged as a zip file; using a suitable archive tool, unpack Red Hat JBoss EAP into a directory to which you have full access.

    Warning

    Do not unpack the archive file into a folder that has spaces in its path name. For example, do not unpack into C:\Documents and Settings\Greco Roman\Desktop\JBoss.
    Additionally, do not unpack the archive file into a folder that has any of the following special characters in its path name: #, %, ^, ".
  3. Once the archive has been extracted JBoss EAP will have been successfully installed. For more information on installation options refer to the Red Hat JBoss EAP Installation Guide.
  4. If JBoss Data Grid is being used in Library mode then refer to Section 4.1, “Deploy JBoss Data Grid in JBoss EAP (Library Mode)” to ensure the necessary dependencies have been installed.
  5. If JBoss Data Grid is being used in Remote Client-Server mode then refer to Section 4.2, “Deploy JBoss Data Grid in JBoss EAP (Remote Client-Server Mode)” to ensure the necessary dependencies have been installed.

5.7.2. Deploy Camel with EAP:

5.7.2.1. Add development and runtime dependencies

In order to compile your application the dependent libraries for Camel and JBoss Data Grid will have to be added to the pom.xml (if using Maven).

Procedure 5.5. Add Camel from Fuse

  1. Ensure that the Fuse repository has been added to the pom.xml:
    <repository>
      <id>fusesource</id>
      <name>FuseSource Release Repository</name>
      <url>https://repo.fusesource.com/nexus/content/groups/public/</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
      <releases>
        <enabled>true</enabled>
      </releases>
    </repository>
  2. Add the Camel components as a dependency in the pom.xml:
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
      <version>${camel.version}</version>
    </dependency>

Procedure 5.6. Add camel-jbossdatagrid to the deployment

  1. Follow the instructions in Chapter 3, Install and Use the Maven Repositories to add the maven repository.
  2. Add camel-jbossdatagrid as a dependency in the pom.xml:
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-jbossdatagrid</artifactId>
      <version>${jdg.version}</version>
    </dependency>
  3. Add in the remaining JBoss Data Grid dependencies depending on which functionality is in use:
    <!-- If Remote Camel Producer is used add the following dependency -->
    <dependency>
    	<groupId>org.infinispan</groupId>
    	<artifactId>infinispan-remote</artifactId>
    	<version>${infinispan.version}</version>
    </dependency>
    	
    <!-- If the Local Camel Producer or Local Camel Consumer are in use add -->
    <!-- the following dependency -->
    <dependency>
    	<groupId>org.infinispan</groupId>
    	<artifactId>infinispan-embedded</artifactId>
    	<version>${infinispan.version}</version>
    </dependency>

5.7.2.2. Optionally: Add runtime dependencies as a JBoss EAP Module

Sometimes it is preferable to maintain other product libraries in JBoss EAP as modules. This requires some additional procedures to create these modules.

Note

When using modules for dependencies the pom.xml will need to have the scope set to "provided" for any dependencies provided as modules. For example:
<dependency>
	<groupId>org.apache.camel</groupId>
	<artifactId>camel-jbossdatagrid</artifactId>
	<scope>provided</scope>
	<version>${jdg.version}</version>
</dependency>
Download jboss-datagrid-${jdg.version}-camel-library.zip from the customer portal.
Extract the apache-camel-${camel.version}.zip found in Red Hat JBoss Fuse's extras/ directory:
user@example modules] unzip /path/to/jboss-fuse-${fuse.version}/extras/apache-camel-${camel.version}

Procedure 5.7. Add in the Camel components from JBoss Fuse

  1. Create a directory under $EAP_HOME/modules:
    user@example jboss-eap-6.4] cd modules
    user@example modules] mkdir -p org/apache/camel/core
  2. Create a main subdirectory to store the jars:
    user@example modules] mkdir org/apache/camel/core/main
  3. Copy over the camel-core jar from apache-camel-${camel.version}.zip to the newly created main directory:
    user@example modules] cp /path/to/jboss/fuse/extras/apache-camel-${camel.version}/lib/camel-core-${camel.version}.jar ./org/apache/camel/core/main/
  4. Create the module.xml descriptor by adding in the following text to org/apache/camel/core/main/module.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.1" name="org.apache.camel.core">
      <resources>
        <resource-root path="camel-core-${camel.version}.jar"/>
      </resources>
    </module>
  5. Repeat the above steps to create a module for each dependency in use; note that modules may have dependencies on other modules as described in the Red Hat JBoss Administration and Configuration Guide.

Procedure 5.8. Add in Camel components from JBoss Data Grid

  1. Create a main subdirectory for the JDG Camel components:
    user@example jboss-eap-6.4] mkdir -p modules/org/apache/camel/main
  2. Unzip jboss-datagrid-${jdg.version}-camel-library.zip.
  3. Copy camel-jbossdatagrid-${jdg.version}.jar into the newly created directory:
    user@example jboss-eap-6.4] cp jboss-datagrid-${jdg.version}-camel-library/camel-jbossdatagrid-${jdg.version}.jar modules/org/apache/camel/main/
  4. Create a module.xml descriptor by adding in the following text to org/apache/camel/main/module.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.1" name="org.apache.camel">
      <resources>
        <resource-root path="camel-jbossdatagrid-${jdg.version}.jar"/>
      </resources>
      <dependencies>
        <module name="org.apache.camel.core" />
      </dependencies>
    </module>
Create a jboss-deployment-structure.xml in the WEB-INF of the war, and add dependencies on the newly created module:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="org.apache.camel" meta-inf="import"/>
            
            <!-- Add the following lines if Library mode is used -->
            <module name="org.infinispan" slot="jdg-7.0" />
            <module name="org.jgroups" slot="jdg-7.0" />
            
            <!-- Add the following lines if Remote Client-Server mode is used -->
            <module name="org.infinispan.client.hotrod" slot="jdg-7.0" />
        </dependencies>
    </deployment>
</jboss-deployment-structure>