High Quality Enterprise Messaging.

SwiftMQ 4.x/JBoss 3.0.3 IntraVM

Introduction

SwiftMQ 4.0.0 introduces a new intra-VM JMS client and includes an MBean in swiftmq.jar to start SwiftMQ as an intra-VM service in JBoss. This has been tested with SwiftMQ 4.0.0 and JBoss 3.0.3.

Note that you have to use the JMS XA/ASF Swiftlet!

Configuration

The following example assumes to use the JBoss default server, located under "<jboss-home>/server/default".

JBoss

SwiftMQ 4.x uses JMS 1.1 but JBoss 3.0.3 includes JMS 1.0.2 classes in "lib/jboss-j2ee.jar" so you have to delete all "javax/jms" classes out of this jar file. Then copy "jms.jar", "dom4j-full.jar" and "swiftmq.jar" from the router's "jars/" directory to JBoss' "lib/" directory.

Delete all "jbossmq-*.xml" files from "deploy/". The only remaining JMS related XML file should be "jms-service.xml".

Edit "deploy/jms-service.xml" and replace this part:

      <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
         name="jboss.mq:service=JMSProviderLoader,name=JBossMQProvider">
        <attribute name="ProviderName">DefaultJMSProvider</attribute>
        <attribute name="ProviderAdapterClass">
          org.jboss.jms.jndi.JBossMQProvider
        </attribute>
        <attribute name="QueueFactoryRef">java:/XAConnectionFactory</attribute>
        <attribute name="TopicFactoryRef">java:/XAConnectionFactory</attribute>
      </mbean>

with this:

      <mbean code="org.jboss.jms.jndi.JMSProviderLoader"
               name="swiftmq:service=JMSProviderLoader,name=SwiftMQProvider">
        <attribute name="ProviderName">DefaultJMSProvider</attribute>
        <attribute name="ProviderUrl">smqp://intravm/timeout=10000</attribute>
        <attribute name="ProviderAdapterClass">com.swiftmq.appserver.jboss.SwiftMQAdapter</attribute>
        <attribute name="QueueFactoryRef">IVMQueueConnectionFactory</attribute>
        <attribute name="TopicFactoryRef">IVMTopicConnectionFactory</attribute>
        <depends>jboss:service=SwiftMQIntraVM</depends>
      </mbean>

Note that "smqp://intravm/timeout=10000" creates an intra-VM connection when using SwiftMQ's JNDI and both connection factory refs are intra-VM connection factories as well.

Next is to edit "conf/jboss-service.xml" to ensure SwiftMQ is started as an intra-VM service in JBoss. Add the MBean to start SwiftMQ right after the JNDI (Naming) MBean:

      <!-- ==================================================================== -->
      <!-- SwiftMQ Router IntraVM                                               -->
      <!-- ==================================================================== -->
      <mbean code="com.swiftmq.appserver.jboss.SwiftMQIntraVMService"
        name="jboss:service=SwiftMQIntraVM">
        <attribute name="RouterWorkingDirectory">d:/swiftmq_4_0_0/scripts/win32</attribute>
        <attribute name="ConfigurationFilename">../../config/router1/routerconfig.xml</attribute>
        <depends>jboss:service=Naming</depends>
      </mbean>

The reason for the dependency from the Naming service is to ensure that it is up before SwiftMQ is started in case you like to use JNDI replication from SwiftMQ into JBoss' JNDI. The attribute "RouterWorkingDirectory" must point to the directory where the "smqr1" etc scripts are located, because any directory references in SwiftMQ's "routerconfig.xml" are relative to this directory. The attribute "ConfigurationFilename" contains the directory/name of the router's configuration file, relative to "RouterWorkingDirectory". Don't specify an absolute path here!

The last configuration step for JBoss is to change a dependency of the "EJBDeployer" service from JBossMQ to SwiftMQ.

Replace:

      <mbean code="org.jboss.ejb.EJBDeployer" name="jboss.ejb:service=EJBDeployer">
        <attribute name="VerifyDeployments">true</attribute>
        <attribute name="ValidateDTDs">false</attribute>
        <attribute name="MetricsEnabled">false</attribute>
        <attribute name="VerifierVerbose">true</attribute>
        <!-- Add a dependency on the JMS provider(jms-service.xml) for MDBs. If
          you are not using MDBs and JMS remove these.
        -->
        <depends>jboss.mq:service=JMSProviderLoader,name=JBossMQProvider</depends>
        <depends>jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool</depends>
      </mbean>

With:

      <mbean code="org.jboss.ejb.EJBDeployer" name="jboss.ejb:service=EJBDeployer">
        <attribute name="VerifyDeployments">true</attribute>
        <attribute name="ValidateDTDs">false</attribute>
        <attribute name="MetricsEnabled">false</attribute>
        <attribute name="VerifierVerbose">true</attribute>
        <!-- Add a dependency on the JMS provider(jms-service.xml) for MDBs. If
          you are not using MDBs and JMS remove these.
        -->
        <depends>swiftmq:service=JMSProviderLoader,name=SwiftMQProvider</depends>
        <depends>jboss.mq:service=ServerSessionPoolMBean,name=StdJMSPool</depends>
      </mbean>

SwiftMQ

That's it! Start JBoss which starts SwiftMQ intra-VM, deploy your beans and enjoy!