You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Deploying JBI Jars to JBoss

We have recently added a JBoss deployer that allows you drop JBI components and service-assemblies directly into your JBoss 4.0.2 deploy directory and have JBoss picks them up and and passes them to a ServiceMix JBI container running right inside the application server. You will see your JBI MBeans in the normal JMX console and be able to access your J2EE resources as you would with a standard JBoss deployable component.

Currently the deployer is available from CVS in tooling/jboss-deployer, the build process is completely managed by Maven, though you will first need to install a SAR plugin for Maven to allow it to build the SAR (Service Archive) for the JBoss deployer. This can be done by checking out tooling/maven-sar-plugin and running:

maven plugin:install

This will install the SAR plugin you can download the jboss-deployer code and run the following goal in Maven:

maven sar:install

You will then find a jboss-deployer-1.0-SNAPSHOT.sar in the target directory, simply take this and drop it in your JBoss deploy directory (currently only tested on JBos 4.0.2), and away you go!!! Want to see it in action? You should be able to drop the JBI RI Transformation Engine example straight into the deploy directory and watch it pick up. Suddenly you have JBI enabled your JBoss Server!

Deploying ServiceMix SpringJBIContainer Configurations

Most of the examples that ship with ServiceMix are not delivered in the JBI component/service assembly form but as servicemix.xml configurations that utilize the SpringJBIContainer infrastructure in ServiceMix. This approach lets you quickly get a JBI architecture up and running and while not directly in-line with the JSR-208 specification it is a powerful approach.

Useful Information

Note that if you are planning on using the components that ship with ServiceMix there libraries are not included in the ServiceMix JBoss deployer, therefore you will need to copy your $SERVICEMIX_HOME/lib and $SERVICEMIX_HOME/lib/optional directories to your application server's library path (ie. $JBOSS_HOME/server/default/lib).

Since it is this approach that most people start with we added the ability to deploy this Spring JBI configurations onto JBoss, in order to do this deploy the jboss-deployer-1.0-SNAPSHOT.sar deployer that you see below and then take a servicemix.xml configuration file and rename it so that it ends in -sm.xml (ie. vfs-sm.xml), then you will need to make same basic modification to get it running:

Example vfs-sm.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:my="http://servicemix.org/demo/">
  <!-- the JBI container -->
  <container id="jbi">  
   <property name="createMBeanServer" value="false"/>
   <property name="dumpStats" value="true"/>
   <property name="statsInterval" value="10"/>  
    <components>
      <!-- Look for files in the inbox directory -->
      <component id="filePoller" service="foo:filePoller" class="org.servicemix.components.vfs.FilePoller" destinationService="foo:receiver">
        <property name="workManager" ref="workManager"/>
        <property name="path" value="file:L:\\servicemix-inbox\"/>
        <property name="period" value="1000"/>
     </component>    
      <!-- Write files to the outbox directory -->
     <component id="fileSender" service="foo:receiver" class="org.servicemix.components.vfs.FileWriter">
        <property name="path" value="file:L:\\servicemix-outbox\"/>
        <property name="marshaler">
           <bean class="org.servicemix.components.util.DefaultFileMarshaler">
              <property name="fileName">
                  <bean class="org.servicemix.expression.JaxenStringXPathExpression">
                     <constructor-arg value="concat('sample_', /sample/@id, '.xml')"/>
                  </bean>
              </property>
           </bean>
        </property>
     </component>
    </components>
  </container>
  <!-- the work manager (thread pool) for this container -->
  <bean id="workManager" class="org.activemq.work.SpringWorkManager">
    <property name="startMaximumPoolSize" value="30"/>
    <property name="syncMaximumPoolSize" value="30"/>
    <property name="scheduledMaximumPoolSize" value="30"/>
  </bean>
</beans>

Above is the VFS example, however note that to run under JBoss you need to make sure that the createMBeanServer property is false.

To make life a little easier you can download the JBoss Deployer for ServiceMix M2

If you want to make use of the *-sm.xml deployer functionality you can download the JBoss Deployer for ServiceMix (Snapshot)

  • No labels