1 2 Previous Next 15 Replies Latest reply on Sep 18, 2012 5:25 PM by ndipiazza Go to original post
      • 15. Re: HQ 2.2.13 - Cannot seem to set up MDB with failover using hard coded list of hosts
        ndipiazza

        Sure!

         

        In my "Correct Answer" you will see a detailed description of the problem. The problem was: without a durable topic... the name of the queue that is referenced is turned into some sort of UUID instead of a queueName.

        Therefore when someone comes to consume the said temporary topic via the name I created it by... it won't exist and you won't be able to subscribe to it.

         

        Let's take a look My MDB looked like this previously:

         

        @MessageDriven(name = "TestMDB", activationConfig = {
              @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
              @ActivationConfigProperty(propertyName = "destination", propertyValue = "abc.pl.testing"),
              @ActivationConfigProperty(propertyName = "setupAttempts", propertyValue = "-1"),
              @ActivationConfigProperty(propertyName = "hA", propertyValue = "true"),
              @ActivationConfigProperty(propertyName = "connectorClassName", propertyValue = "org.hornetq.core.remoting.impl.netty.NettyConnectorFactory,org.hornetq.core.remoting.impl.netty.NettyConnectorFactory"),
              @ActivationConfigProperty(propertyName = "connectionParameters", propertyValue = "host=1.1.1.1;port=5445,host=2.2.2.2;port=5445") })
        public class TestMDB implements MessageListener
        

         

        So when it hits this if statement between Lines 103 and 176 of org/hornetq/ra/inflow/HornetQMessageHandler.java:

         

        if (activation.isTopic() && spec.isSubscriptionDurable())
         
         
        { // our mdb is not durable so we will hit the else clause
         
         // ....
        } else {
         SimpleString queueName;
                 if (activation.isTopic())
                 {
                    if (activation.getTopicTemporaryQueue() == null)
                    {
                       queueName = new SimpleString(UUID.randomUUID().toString());
                       session.createQueue(activation.getAddress(), queueName, selectorString, false);
                       activation.setTopicTemporaryQueue(queueName);
                    }
                    else
                    {
                       queueName = activation.getTopicTemporaryQueue();
                    }
                 }
                 else
                 {
                    queueName = activation.getAddress();
                 }
                 consumer = session.createConsumer(queueName, selectorString);
        

         

        Because I did not specify topicTemporaryQueue anywhere... that will be null. So it will create a random queue name.

         

        This doesn't seem right to me. I worked around it by making the message durable thus not hitting this code at all.

         

        What is up with this if statement? Is this really supposed to be how it works? The MDB annotations seem pretty straight forward.

         

        What MDB annotation can i use to make this work correctly with a non-durable topic?

        1 2 Previous Next