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

Compare with Current View Page History

« Previous Version 16 Next »

Deploying JBI Jars to JBoss

This document discusses how to deploy ServiceMix to the JBoss application server.

The JBoss deployer has been enhanced to allow JBI components and service-assemblies to be installed and deployed directly into the JBoss 4.0 deploy directory. From the deploy directory, JBoss picks them up and and passes them to a ServiceMix JBI container running inside of the JBoss application server. After deployment, JBI MBeans can be seen in a JMX console and J2EE resources can be accessed as you would with a standard JBoss deployable component.

The JBoss JMX Console Showing the ServiceMix Deployment:

Installing the JBoss Deployer

Due to licensing reasons, the JBoss deployer is available at Codehaus.
You can build it using the following commands.

svn co http://svn.codehaus.org/servicemix/trunk/jboss-deployer
cd jboss-deployer
mvn install

You will then find a jboss-deployer-3.0-incubating-SNAPSHOT.sar in the target directory, simply take this and drop it in your JBoss deploy directory (currently only tested on JBos 4.0.3), 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 XBean 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 XBean 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-2.0.sar deployer that you see below . Next, take a servicemix.xml configuration file and rename it so that it ends in -sm.xml (ie. filebind-sm.xml).  Place the configuration file in the JBoss deploy directory.   Before you do that, you will need to make some basic modifications to the configuration file to get it running, namely you will need to make sure that the createMBeanServer property is false.  Below is the file binding example configured to run under JBoss.

Example filebinding-sm.xml for ServiceMix 3.0

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:sm="http://servicemix.apache.org/config/1.0"
       xmlns:foo="http://servicemix.org/demo/">

	<!-- the JBI container -->
	<sm:container id="jbi" 
                useMBeanServer="false"
   	            createMBeanServer="false" 
                dumpStats="true" 
                statsInterval="10">

		<sm:activationSpecs>

			<!-- Write files to the outbox directory -->
			<sm:activationSpec componentName="fileSender"
				                service="foo:fileSender">
				<sm:component>
					<bean class="org.apache.servicemix.components.file.FileWriter">
						<property name="directory" value="outbox" />
						<property name="marshaler">
							<bean class="org.apache.servicemix.components.util.DefaultFileMarshaler">
								<property name="fileName">
									<bean class="org.apache.servicemix.expression.JaxenStringXPathExpression">
										<constructor-arg value="concat('sample_', /sample/@id, '.xml')" />
									</bean>
								</property>
							</bean>
						</property>
					</bean>
				</sm:component>
			</sm:activationSpec>

			<!-- Look for files in the inbox directory -->
			<sm:activationSpec componentName="filePoller"
				                 destinationService="foo:fileSender" 
                         service="foo:filePoller">
				<sm:component>
					<bean class="org.apache.servicemix.components.file.FilePoller">
						<property name="workManager" ref="workManager" />
						<property name="file" value="inbox" />
						<property name="period" value="1000" />
					</bean>
				</sm:component>
			</sm:activationSpec>
		</sm:activationSpecs>
	</sm:container>

	<!-- the work manager (thread pool) for this container -->
	<bean id="workManager" class="org.jencks.factory.WorkManagerFactoryBean">
		<property name="threadPoolSize" value="30" />
	</bean>

</beans>

 

  • No labels