4 Replies Latest reply on Aug 1, 2013 8:16 AM by Florin Slev

    Durable hornetQ core queue doesn't survive restart.

    Florin Slev Newbie

      Hello,

      I have Jboss AS 7.2.0.FInal with HornetQ2.3.0.CR2 embedded in it.

       

      If I am creating a durabe core queue and send messages to it, everything works fine. But when I am restarting the server and reconnect the ClientSession and when trying to attach a consumer to the durable core queue, a client error is generated saying that QUEUE DOES NOT EXIST.

      My code:

       

      ....

       

                          final String topicCoreAddress = "jms.topic.ExampleTopic1";

                          final String subName1 = "clientID.topic-subscription-A";

                          final String subName2 = "clientID.topic-subscription-B";

       

       

                          ClientConsumer consumer1 = null;

                          ClientConsumer consumer2 = null;

       

                          try {

       

       

                                    factory = locator.createSessionFactory();

                                    session = factory.createSession(APPLICATIONREALM_USER,

                                                        APPLICATIONREALM_USER_PWD, false, true, true, true, 1);

       

       

                                    session.createQueue(topicCoreAddress, subName1, true);

                                    session.createQueue(topicCoreAddress, subName2, true);

       

                                      ClientProducer producer = session.createProducer(topicCoreAddress);

       

                                     ClientMessage message = null;

       

                                     for (int i = 0; i < MESSAGE_NO; i++) {

                                message = session.createMessage(true);

                                message.setDurable(true);

                                                                      producer.send(message);

                                    }

       

       

                                        // Restart server. We test durable messages and durable

                                    serverManagerWrapper.reloadServer(60000);

       

       

                                    // Create a new connection session

                                    factory = locator.createSessionFactory();

                                    session = factory.createSession(APPLICATIONREALM_USER,

                                                        APPLICATIONREALM_USER_PWD, false, true, true, true, 1);

       

                                     session.start();

       

      [Line: 376]   consumer1 = session.createConsumer(subName1);

                         consumer2 = session.createConsumer(subName2);

       

      Strange thing is that this error happens only sometimes. To be noted that the node to which I am making the connection is inside a cluster.

       

      ERROR after restart at line 376.

       

      Error Message

       

       

      HornetQException[errorType=QUEUE_DOES_NOT_EXIST message=null]

       

       

      Stacktrace

       

       

      java.lang.RuntimeException: HornetQException[errorType=QUEUE_DOES_NOT_EXIST message=null]

                at com.oneandone.qatro.spp_stylish_testsuite.hornetq_simple.client.tests.topic.TopicExamplesRunnerTest.runHornetQCoreClient_Topic_DurableSubscriber_Example(TopicExamplesRunnerTest.java:379)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

                at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

                at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

                at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

                at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)

                at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)

                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)

                at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)

                at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)

                at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)

                at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)

                at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

                at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:236)

                at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:134)

                at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:113)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)

                at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)

                at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)

                at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)

                at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74)

      Caused by: HornetQException[errorType=QUEUE_DOES_NOT_EXIST message=null]

                at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:378)

                at org.hornetq.core.client.impl.ClientSessionImpl.deleteQueue(ClientSessionImpl.java:375)

                at org.hornetq.core.client.impl.ClientSessionImpl.deleteQueue(ClientSessionImpl.java:385)

                at org.hornetq.core.client.impl.DelegatingSession.deleteQueue(DelegatingSession.java:329)

                at com.oneandone.qatro.spp_stylish_testsuite.hornetq_simple.client.tests.topic.TopicExamplesRunnerTest.runHornetQCoreClient_Topic_DurableSubscriber_Example(TopicExamplesRunnerTest.java:376)

                ... 28 more