Version 2

    JBoss AS 5 uses JBoss Messaging as its default JMS implementation and JBoss AS 7 uses HornetQ as its default JMS implementation.  If one needs to migrate JMS messages from one environment to the other a JMS bridge is the easiest way.  At this point, AS 7 doesn't yet have a JMS bridge generally available (follow AS7-4268 to keep tabs on this), but one can deploy a JMS bridge on AS 5 to move messages to AS 7.  However, setting up this bridge isn't as straight-forward as setting up a normal JMS bridge because of conflicts between the AS 5 and AS 7 classes.  Here's how you do it:

     

    1. Create a directory named myBridge.sar in <JBOSS5_HOME>/server/<profile>/deploy.
    2. Create a directory named META-INF in <JBOSS5_HOME>/server/<profile>/deploy/myBridge.sar
    3. Place a jboss-service.xml like this into <JBOSS5_HOME>/server/<profile>/deploy/myBridge.sar/META-INF.  Note: The <load-repository> is present to ensure the SAR has an isolated classloader.

     

    <server>
       <loader-repository>
          com.example:archive=unique-archive-name
          <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
       </loader-repository> 
    
       <!-- AS7 JMS Provider --> 
       <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="jboss.messaging:service=JMSProviderLoader,name=AS7JMSProvider">
          <attribute name="ProviderName">AS7JMSProvider</attribute>
          <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
          <attribute name="FactoryRef">jms/RemoteConnectionFactory</attribute> 
          <attribute name="QueueFactoryRef">jms/RemoteConnectionFactory</attribute>  
          <attribute name="TopicFactoryRef">jms/RemoteConnectionFactory</attribute>      
          <attribute name="Properties">
             java.naming.factory.initial=org.jboss.naming.remote.client.InitialContextFactory
             java.naming.provider.url=remote://as7host:4447
             java.naming.security.principal=user
             java.naming.security.credentials=pass
          </attribute>
       </mbean> 
    
       <mbean code="org.jboss.jms.server.bridge.BridgeService" name="jboss.jms:service=Bridge,name=AS5toAS7Bridge" xmbean-dd="xmdesc/Bridge-xmbean.xml">      
          <depends optional-attribute-name="SourceProviderLoader">jboss.messaging:service=JMSProviderLoader,name=JMSProvider</depends>          
          <depends optional-attribute-name="TargetProviderLoader">jboss.messaging:service=JMSProviderLoader,name=AS7JMSProvider</depends>          
          <attribute name="SourceDestinationLookup">/queue/A</attribute>      
          <attribute name="TargetDestinationLookup">jms/queue/test</attribute>       
          <attribute name="QualityOfServiceMode">1</attribute>           
          <attribute name="MaxBatchSize">1</attribute>      
          <attribute name="MaxBatchTime">-1</attribute>           
          <attribute name="FailureRetryInterval">60000</attribute>      
          <attribute name="MaxRetries">-1</attribute>      
          <attribute name="AddMessageIDInHeader">false</attribute>
          <attribute name="TargetUsername">user</attribute>
          <attribute name="TargetPassword">pass</attribute>
       </mbean>
    </server>
    

     

    1. Place the following JARs from <JBOSS7_HOME>/modules in <JBOSS5_HOME>/server/<profile>/deploy/myBridge.sar.  The version numbers may differ based on what version of AS 7 you are using.  Note: One can't simply use <JBOSS7_HOME>/bin/client/jboss-client.jar because it contains many javax API classes which will interfere with those from AS 5.
      • hornetq-core-2.2.13.Final.jar (in org/hornetq/main)

      • hornetq-jms-2.2.13.Final.jar (in org/hornetq/main)

      • jboss-ejb-client-1.0.5.Final.jar (in org/jboss/ejb-client/main)

      • jboss-logging-3.1.0.GA.jar (in org/jboss/logging/main)

      • jboss-logmanager-1.2.2.GA.jar (in org/jboss/logmanager/main)

      • jboss-marshalling-1.3.11.GA.jar (in org/jboss/marshalling/main)

      • jboss-marshalling-river-1.3.11.GA.jar (in org/jboss/marshalling/river/main)

      • jboss-remote-naming-1.0.2.Final.jar (in org/jboss/remote-naming/main)

      • jboss-remoting-3.2.3.GA.jar (in org/jboss/remoting3/main)

      • jboss-sasl-1.0.0.Final.jar (in org/jboss/sasl/main)

      • netty-3.2.6.Final.jar (in org/jboss/netty/main)

      • remoting-jmx-1.0.2.Final.jar (in org/jboss/remoting3/remote-jmx/main)

      • xnio-api-3.0.3.GA.jar (in org/jboss/xnio/main)

      • xnio-nio-3.0.3.GA.jar (in org/jboss/xnio/nio/main)

     

    You can, of course, change the name of the SAR directory as well as the name of the bridge to suit your environment.  Also, please note that both the JNDI look-up and the bridge "target" include security credentials.  This is because AS 7 is secured by default.  For this particular bridge configuration I created a user named user with a password pass in the ApplicationRealm and in the guest role using the <JBOSS7_HOME>/bin/add_user.sh script.