9 Replies Latest reply on Dec 10, 2010 1:25 AM by jalandip

    Migrating from JBossMQ to HornetQ

    lafr

      Up to now I used JBoss 4.2x with JBossMQ.

      To add additional queues we put a new file, for example mbi345-jbossmq-service.xml, into the deploy directory with this content:

      <?xml version="1.0" encoding="UTF-8"?>
      <server>
         <mbean code="org.jboss.mq.server.jmx.Queue"  name="jboss.mq.destination:service=Queue,name=mbi345/MessageDistributorQueue">
           <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
         </mbean>
         <mbean code="org.jboss.mq.server.jmx.Queue" name="jboss.mq.destination:service=Queue,name=mbi345/SalesOrderImportQueue">
           <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
         </mbean>
      </server>

      One jbossmq-service.xml for each application instance (ear file).

       

      How to add additional Queues in seperate files when using JBossAS-6.0 which includes HornetQ?

       

      With hornetq-queues.xml it seems to be possible to add queues, but there can only be one.

        • 1. Re: Migrating from JBossMQ to HornetQ
          jaikiran

          If you are using HornetQ within JBoss AS, then you can just create a *-hornetq-jms.xml file and package it with your application or place it in the deploy folder. The *-hornetq-jms.xml files are picked up by JBoss AS and the queue/topics defined in that file will be deployed. For an example, see the JBOSS_HOME/server/default/deploy/hornetq/hornetq-jms.xml file in AS 6.0.0.M4. Here's an example:

          <queue name="MessageDistributorQueue">
                <entry name="/queue/mbi345/MessageDistributorQueue"/>
             </queue>
          

           

          More about this can be found in the HornetQ documentation. More specifically http://hornetq.sourceforge.net/docs/hornetq-2.1.2.Final/user-manual/en/html/configuration-index.html#d0e12990

          • 2. Re: Migrating from JBossMQ to HornetQ
            lafr

            Perfect.

            That's what I was searching for.

            I read the docs before I published my problem here but in the docs it's not mentioned that there can be multiple files with the -hornetq-jms.xml suffix.

            • 3. Re: Migrating from JBossMQ to HornetQ
              ohmygod

              jaikiran pai wrote:

               

              If you are using HornetQ within JBoss AS, then you can just create a *-hornetq-jms.xml file and package it with your application or place it in the deploy folder. The *-hornetq-jms.xml files are picked up by JBoss AS and the queue/topics defined in that file will be deployed. For an example, see the JBOSS_HOME/server/default/deploy/hornetq/hornetq-jms.xml file in AS 6.0.0.M4. Here's an example:

              
              <queue name="MessageDistributorQueue">
                    <entry name="/queue/mbi345/MessageDistributorQueue"/>
                 </queue>
              

               

              More about this can be found in the HornetQ documentation. More specifically http://hornetq.sourceforge.net/docs/hornetq-2.1.2.Final/user-manual/en/html/configuration-index.html#d0e12990

              Can you advise where I am wrong? I added the topic/queue configuration above </configuration> node in hotnetq-jms.xml under hotnetq folder but it seems the configuration is not correct.

               

              <topic name="com.globalsight.cxe.jms.ForFileSystemSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForFileSystemSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForFileSystemTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForFileSystemTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForExtractor">
                  <entry name="/topic/com.globalsight.cxe.jms.ForExtractor"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForMerger">
                  <entry name="/topic/com.globalsight.cxe.jms.ForMerger"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForCapSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForCapSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForCapTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForCapTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForMsOfficeSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForMsOfficeSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForMsOfficeTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForMsOfficeTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForPdfSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForPdfSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForPdfTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForPdfTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForAdobeSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForAdobeSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForAdobeTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForAdobeTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForIdmlSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForIdmlSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForIdmlTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForIdmlTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForOpenOfficeSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForOpenOfficeSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForOpenOfficeTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForOpenOfficeTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForTeamSiteSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForTeamSiteSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForTeamSiteTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForTeamSiteTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForQuarkFrameSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForQuarkFrameSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForQuarkFrameTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForQuarkFrameTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForCopyFlowSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForCopyFlowSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForCopyFlowTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForCopyFlowTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForVignetteSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForVignetteSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForVignetteTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForVignetteTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForDatabaseTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForDatabaseTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForMediasurfaceSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForMediasurfaceSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForMediasurfaceTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForMediasurfaceTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForCatalystSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForCatalystSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForCatalystTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForCatalystTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForServiceWareSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForServiceWareSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForServiceWareTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForServiceWareTargetAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForDocumentumSourceAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForDocumentumSourceAdapter"/>
              </topic>
              <topic name="com.globalsight.cxe.jms.ForDocumentumTargetAdapter">
                  <entry name="/topic/com.globalsight.cxe.jms.ForDocumentumTargetAdapter"/>
              </topic>
              <queue name="com.globalsight.cxe.jms.CapImporting">
                  <entry name="/queue/com.globalsight.cxe.jms.CapImporting"/>
              </queue>
              <queue name="com.globalsight.cxe.jms.CapImporting2">
                  <entry name="/queue/com.globalsight.cxe.jms.CapImporting2"/>
              </queue>
              <queue name="com.globalsight.cxe.jms.CapImporting3">
                  <entry name="/queue/com.globalsight.cxe.jms.CapImporting3"/>
              </queue>
              <queue name="com.globalsight.cxe.jms.CapImporting4">
                  <entry name="/queue/com.globalsight.cxe.jms.CapImporting4"/>
              </queue>
              <queue name="com.globalsight.cxe.jms.CapImporting5">
                  <entry name="/queue/com.globalsight.cxe.jms.CapImporting5"/>
              </queue>
              <queue name="com.globalsight.cxe.jms.Aligner">
                  <entry name="/queue/com.globalsight.cxe.jms.Aligner"/>
              </queue>
              <queue name="com.globalsight.jms.FluxEventScheduling">
                  <entry name="/queue/com.globalsight.jms.FluxEventScheduling"/>
              </queue>
              <queue name="com.globalsight.everest.jms.CostCalculations">
                  <entry name="/queue/com.globalsight.everest.jms.CostCalculations"/>
              </queue>
              <queue name="com.globalsight.everest.jms.CapExporting">
                  <entry name="/queue/com.globalsight.everest.jms.CapExporting"/>
              </queue>
              <queue name="com.globalsight.everest.jms.FileUpload">
                  <entry name="/queue/com.globalsight.everest.jms.FileUpload"/>
              </queue>
              <queue name="com.globalsight.everest.jms.WorkflowAdditions">
                  <entry name="/queue/com.globalsight.everest.jms.WorkflowAdditions"/>
              </queue>
              <queue name="com.globalsight.everest.jms.ProjectUpdate">
                  <entry name="/queue/com.globalsight.everest.jms.ProjectUpdate"/>
              </queue>
              <queue name="com.globalsight.terminology.jms.TermAuditLog">
                  <entry name="/queue/com.globalsight.terminology.jms.TermAuditLog"/>
              </queue>
              <queue name="com.globalsight.everest.jms.TermbaseDeletion">
                  <entry name="/queue/com.globalsight.everest.jms.TermbaseDeletion"/>
              </queue>
              <queue name="com.globalsight.everest.jms.TrashCompaction">
                  <entry name="/queue/com.globalsight.everest.jms.TrashCompaction"/>
              </queue>
              <queue name="com.globalsight.everest.jms.MailSender">
                  <entry name="/queue/com.globalsight.everest.jms.MailSender"/>
              </queue>
              <queue name="com.globalsight.everest.jms.NewCompany">
                  <entry name="/queue/com.globalsight.everest.jms.NewCompany"/>
              </queue>
              <queue name="com.globalsight.everest.jms.JobCancel">
                  <entry name="/queue/com.globalsight.everest.jms.JobCancel"/>
              </queue>
              <queue name="com.globalsight.everest.jms.WorkflowCancel">
                  <entry name="/queue/com.globalsight.everest.jms.WorkflowCancel"/>
              </queue>
              <queue name="com.globalsight.everest.jms.UpdateLeverageMatchMDB">
                  <entry name="/queue/com.globalsight.everest.jms.UpdateLeverageMatchMDB"/>
              </queue>
              <queue name="com.globalsight.everest.jms.AddSourceFile">
                  <entry name="/queue/com.globalsight.everest.jms.AddSourceFile"/>
              </queue>

               

              This error reports for the MDBs one by one. http://community.jboss.org/thread/159666

               

              I have configured the MDBs in jboss.xml and ejb-jar.xml under this directory deploy\globalsight.ear\cxe-ejb.jar\META-INF (working fine in previous version). Please advise. Thanks very much.

              • 4. Re: Migrating from JBossMQ to HornetQ
                clebert.suconic

                The file should follow the same syntax as the main JMX Confguration file: as listed here on the docs: http://hornetq.sourceforge.net/docs/hornetq-2.1.2.Final/user-manual/en/html/using-jms.html

                • 5. Re: Migrating from JBossMQ to HornetQ
                  brian.hayes

                  Mike - I'm not sure if you've gotten into this part yet but I too am in your situation looking to migrate an application that needs to handle north of 1 Mill messages an hour going from MQ to HornetQ. The translation between jboss.xml and ejb-jar.xml to HornetQ isn't (to me) as straight forward as it seams. (And yes I am going blind from reading the docs.)

                   

                  I hope I am way off but from what I can tell:

                   

                  1. For all the information in jboss.xml and/or ejb-jar.xml will need to go into hornetq-configuration.xml because you can't define much other than the actual Queue in the hornetq-jms.xml file.

                  2. I could only get hornetq-jms.xml to ever load from the classpath. I've put every combination of *.hornetq-jms.xml in the deploy folder, in my ear file, etc.. and nothing works but directly editing the hornetq-configuration.xml and hornetq-jms.xml file on the server.

                   

                  For example we use custom DQL's that in MQ work just fine by putting the below information in jboss.xml - Now I have to put similar information into hornetq-configuration.xml. Also, I use maven to replace ${client.name} with the actual client name so that my files are all dynamically created, which worked perfectly with MQ. I would have a ${client.name}-jbossmq-service.xml.

                   

                   

                   

                          <message-driven>

                            <ejb-name>${client.name}EmailInMDB</ejb-name>

                            <destination-jndi-name>queue/${client.name}/EmailIn</destination-jndi-name>

                            <invoker-bindings>

                              <invoker>

                                <invoker-proxy-binding-name>${client.name}-email-in-message-driven-bean</invoker-proxy-binding-name>

                              </invoker>

                            </invoker-bindings>

                          </message-driven>

                   

                   

                      <invoker-proxy-binding>

                        <name>${client.name}-email-in-message-driven-bean</name>

                        <invoker-mbean>${client.name}-email-in-message-driven-bean</invoker-mbean>

                        <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>

                        <proxy-factory-config>

                          <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>

                          <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>

                          <MaximumSize>4</MaximumSize>

                          <MaxMessages>2</MaxMessages>

                          <MDBConfig>

                            <ReconnectIntervalSec>10</ReconnectIntervalSec>

                            <DLQConfig>

                              <DestinationQueue>queue/${client.name}/EmailInDLQ</DestinationQueue>

                              <MaxTimesRedelivered>0</MaxTimesRedelivered>

                              <TimeToLive>0</TimeToLive>

                            </DLQConfig>

                          </MDBConfig>

                        </proxy-factory-config>

                      </invoker-proxy-binding>

                   

                   

                  In order to get the DQL to work,  added the below  into hornetq-configuration.xml , which it seems only the one file on the server is ever read from.

                   

                  <!-- Client DQL settings in jboss.xml seem to not work. so inside hornetq-configuration.xml I put this -->

                   

                  <address-setting match="jms.queue.${client.name}/EmailIn">

                     <dead-letter-address>jms.queue.${client.name}/EmailInDLQ</dead-letter-address>

                     <max-delivery-attempts>3</max-delivery-attempts>

                     <message-counter-history-day-limit>10</message-counter-history-day-limit>

                  </address-setting>

                   

                   

                   

                          <message-driven>
                            <ejb-name>${client.name}EmailInMDB</ejb-name>
                            <destination-jndi-name>queue/${client.name}/EmailIn</destination-jndi-name>
                            <invoker-bindings>
                              <invoker>
                                <invoker-proxy-binding-name>${client.name}-email-in-message-driven-bean</invoker-proxy-binding-name>
                              </invoker>
                            </invoker-bindings>
                          </message-driven>
                      <invoker-proxy-binding>
                        <name>${client.name}-email-in-message-driven-bean</name>
                        <invoker-mbean>${client.name}-email-in-message-driven-bean</invoker-mbean>
                        <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
                        <proxy-factory-config>
                          <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>
                          <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>
                          <MaximumSize>4</MaximumSize>
                          <MaxMessages>2</MaxMessages>
                          <MDBConfig>
                            <ReconnectIntervalSec>10</ReconnectIntervalSec>
                            <DLQConfig>
                              <DestinationQueue>queue/${client.name}/EmailInDLQ</DestinationQueue>
                              <MaxTimesRedelivered>0</MaxTimesRedelivered>
                              <TimeToLive>0</TimeToLive>
                            </DLQConfig>
                          </MDBConfig>
                        </proxy-factory-config>
                      </invoker-proxy-binding>
                  <!-- Client DQL settings. seems the ones in jboss.jar do not work. --><address-setting match="jms.queue.VU/EmailIn">  <dead-letter-address>jms.queue.VU/EmailInDLQ</dead-letter-address>  <max-delivery-attempts>3</max-delivery-attempts>  <message-counter-history-day-limit>10</message-counter-history-day-limit></address-setting>
                  <!-- Client DQL settings. seems the ones in jboss.jar do not work. -->
                  <address-setting match="jms.queue.VU/EmailIn">
                    <dead-letter-address>jms.queue.VU/EmailInDLQ</dead-letter-address>
                    <max-delivery-attempts>3</max-delivery-attempts>
                    <message-counter-history-day-limit>10</message-counter-history-day-limit>
                  </address-setting>
                  • 6. Re: Migrating from JBossMQ to HornetQ
                    clebert.suconic

                    With JBossMQ, the DLQ was part of the Resource Adapter what was a design flaw back then.

                     

                    HornetQ will control its own DLQ (we call it DLA - Dead Letter Address as you can use publish subscription for them, not just JMS Queues). Look at the docs for more information.

                    • 7. Re: Migrating from JBossMQ to HornetQ
                      brian.hayes

                      Is that why with HornetQ/Jboss 5x the jboss.xml allows the definition to exist but does nothing with half the information? Speaking of read the docs Can you point me to a migration document? I am about to post something that I experiencing where the cluster of MDB's when empty startup just fine but once messages start flowing in, the messages coming in aren't getting balanced across the internal beans and half of them are not being processed. I know it's something to do with my config's but "reading the doc's" aren't helping me out.

                       

                      Example:

                          <invoker-proxy-binding>

                            <name>${client.name}-email-in-message-driven-bean</name>

                            <invoker-mbean>${client.name}-email-in-message-driven-bean</invoker-mbean>

                            <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>

                            <proxy-factory-config>

                              <JMSProviderAdapterJNDI>DefaultJMSProvider</JMSProviderAdapterJNDI>

                              <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>

                              <MaximumSize>2</MaximumSize>

                              <MaxMessages>1</MaxMessages>

                              <MDBConfig>

                                <ReconnectIntervalSec>10</ReconnectIntervalSec>

                                <DLQConfig>

                                  <DestinationQueue>queue/${client.name}/EmailInDLQ</DestinationQueue>

                                  <MaxTimesRedelivered>0</MaxTimesRedelivered>

                                  <TimeToLive>0</TimeToLive>

                                </DLQConfig>

                              </MDBConfig>

                            </proxy-factory-config>

                          </invoker-proxy-binding>

                      • 8. Re: Migrating from JBossMQ to HornetQ
                        ataylor
                        Is that why with HornetQ/Jboss 5x the jboss.xml allows the definition to exist but does nothing with half the information?

                        Yes, this information is used by jboss and the generic jboss jca adaptor, since we provide our own jca adaptor obviosuly this info isn't used.

                        • 9. Re: Migrating from JBossMQ to HornetQ
                          jalandip

                          Hi Brian

                          we are using Jboss 4.2.3 with HornetQ 2.1.2 Final. From what i know in jboss 4.2.X  the ear deployers does not parse hornetq-*.xml files i dont know if that is the case with 5.X also. So in our case we had to write some custom code to read those files from the ears and used the core api to deploy them.