2 Replies Latest reply on Dec 6, 2013 4:34 AM by developer251

    Diverts not working - why ?

    developer251

      Hi all HornetQ users,

      I'd need to use diverts in my application to route messages from one destination to another.

       

      My application is deployed on JBoss 7.2 which uses HornetQ 2.3.1 and contains two Queues:

       

                          <jms-queue name="test">

                              <entry name="java:/jms/queue/test"/>

                              <entry name="java:jboss/exported/jms/queue/test"/>

                              <durable>true</durable>

                          </jms-queue>

                          <jms-queue name="divert">

                              <entry name="java:/jms/queue/divert"/>

                              <entry name="java:jboss/exported/jms/queue/divert"/>

                              <durable>true</durable>

                          </jms-queue>

                      </jms-destinations>

       

      I have also an MDB which is bound on the test queue:

      @MessageDriven(name = "QueueMDB", activationConfig = {

              @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

              @ActivationConfigProperty(propertyName = "destination", propertyValue = "java:/jms/queue/test"),

              @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })

      public class QueueMDB implements MessageListener { ...

       

      Now I'm sending messages using a JMS client to the queue named "divert" and expect, with the following definition to have my messages consumed by the MDB bound to the queue "test":

       

                  <diverts>

                          <divert name="route1">

                              <routing-name>route1</routing-name>

                              <address>divert</address>

                              <forwarding-address>test</forwarding-address>

                              <exclusive>true</exclusive>

                          </divert>

                      </diverts>

       

      Unfortunately, I can see that messages are not routed and just stay on the divert destination, not consumed by the MDB.

      Is there something wrong in my configuration? maybe MDB are not able to receive message using Diverts ?

       

      Thanks

      Max

        • 1. Re: Diverts not working - why ?
          jbertram

          Is there something wrong in my configuration?

          Yes, I believe there is something wrong in your configuration.  Try using this for your divert:

           

                              <divert name="route1">

                                  <routing-name>route1</routing-name>

                                  <address>jms.queue.divert</address>

                                  <forwarding-address>jms.queue.test</forwarding-address>

                                  <exclusive>true</exclusive>

                              </divert>

           

          When using "core" artifacts (like diverts) on JMS artifacts (like jms-queue) you have to keep in mind how the JMS-to-core mapping works.  See http://docs.jboss.org/hornetq/2.3.0.Final/docs/user-manual/html/jms-core-mapping.html for more details.

          • 2. Re: Diverts not working - why ?
            developer251

            Thanks it works- it is a bit misleading that the WildFly Administration console "suggests" the name without the correct HornetQ mapping (in my case "divert" and "test"). However now it works! Thanks!