3.2.5. HornetQ Changes

3.2.5.1. Configure a JMS Bridge to Migrate Existing JMS Messages to JBoss Enterprise Application Platform 6

JBoss Enterprise Application Platform 6 replaced JBoss Messaging with HornetQ as the default JMS implementation. The easiest way to migrate JMS messages from one environment to the other is to use a JMS bridge. Although JBoss Enterprise Application Platform 6 does not currently have a JMS bridge available, you can deploy a JMS bridge to JBoss Enterprise Application Platform 5.x to move the messages to JBoss Enterprise Application Platform 6. To avoid conflicts in classes between releases, you must use the following procedure to configure the JMS bridge. The names of the SAR directory and bridge are arbitrary and can be changed if you prefer.

Procedure 3.19. Configure the JMS Bridge

  1. Create a subdirectory in the JBoss Enterprise Application Platform 5 deploy directory to contain the SAR, for example: EAP5_HOME/server/PROFILE_NAME/deploy/myBridge.sar.
  2. Create a subdirectory named META-INF in EAP5_HOME/server/PROFILE_NAME/deploy/myBridge.sar/.
  3. Create a jboss-service.xml file that contains information similar to the following in the EAP5_HOME/server/PROFILE_NAME/deploy/myBridge.sar/META-INF/ directory.
    <server>
       <loader-repository>
          com.example:archive=unique-archive-name
          <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
       </loader-repository> 
    
       <!-- JBoss Enterprise Application Platform 6 JMS Provider --> 
       <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="jboss.messaging:service=JMSProviderLoader,name=EnterpriseApplicationPlatform6JMSProvider">
          <attribute name="ProviderName">EnterpriseApplicationPlatform6JMSProvider</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://EnterpriseApplicationPlatform6host:4447
             java.naming.security.principal=jbossuser
             java.naming.security.credentials=jbosspass
          </attribute>
       </mbean> 
    
       <mbean code="org.jboss.jms.server.bridge.BridgeService" name="jboss.jms:service=Bridge,name=MyBridgeName" 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=EnterpriseApplicationPlatform6JMSProvider</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">jbossuser</attribute>
          <attribute name="TargetPassword">jbosspass</attribute>
       </mbean>
    </server>
    
    

    Note

    The <load-repository> is present to ensure the SAR has an isolated classloader. Also note both the JNDI look-up and the bridge "target" include security credentials for user "jbossuser" with password "jbosspass". This is because JBoss Enterprise Application Platform 6 is secured by default. The user named "jbossuser" with password "jbosspass" was created in the ApplicationRealm with the guest role using the EAP_HOME/bin/add_user.sh script.
  4. Copy the following JARs from the EAP_HOME/modules/ directory into the EAP5_HOME/server/PROFILE_NAME/deploy/myBridge.sar/ directory. Replace each VERSION_NUMBER with the actual version number in your JBoss Enterprise Application Platform 6 distribution.
    • org/hornetq/main/hornetq-core-VERSION_NUMBER.jar
    • org/hornetq/main/hornetq-jms-VERSION_NUMBER.jar
    • org/jboss/ejb-client/main/jboss-ejb-client-VERSION_NUMBER.jar
    • org/jboss/logging/main/jboss-logging-VERSION_NUMBER.jar
    • org/jboss/logmanager/main/jboss-logmanager-VERSION_NUMBER.jar
    • org/jboss/marshalling/main/jboss-marshalling-VERSION_NUMBER.jar
    • org/jboss/marshalling/river/main/jboss-marshalling-river-VERSION_NUMBER.jar
    • org/jboss/remote-naming/main/jboss-remote-naming-VERSION_NUMBER.jar
    • org/jboss/remoting3/main/jboss-remoting-VERSION_NUMBER.jar
    • org/jboss/sasl/main/jboss-sasl-VERSION_NUMBER.jar
    • org/jboss/netty/main/netty-VERSION_NUMBER.jar
    • org/jboss/remoting3/remote-jmx/main/remoting-jmx-VERSION_NUMBER.jar
    • org/jboss/xnio/main/xnio-api-VERSION_NUMBER.jar
    • org/jboss/xnio/nio/main.xnio-nio-VERSION_NUMBER.jar

    Note

    Do not simply copy the EAP_HOME/bin/client/jboss-client.jar because the javax API classes will conflict with those in JBoss Enterprise Application Platform 5.x.