9 Replies Latest reply on Aug 26, 2013 11:15 AM by dheinzh3

    clustered-queue example is not working.

    verystrongjoe

      I'm wacthing the example, clustered queue, 2.3.0.BETA3.

      During running, I saw two kinds of errors, i didn't add or modify example source.

       

      I modfied source for consume behavior to be invoked not by receivce function of consumer class

      but the listener injected to consumer.. so I added two listeners.

       

      consumer0.setMessageListener(listener5000);  // it takes 5000 milli-secs.

      consumer1.setMessageListener(listener); // it takes 0 sec.

       

      and the listener implementation is like  below..

       

      private final MessageListener listener = new MessageListener() {

                @Override

                public void onMessage(Message message) {

                          System.out.println("*********"  + message.toString() );

                }

      };

       

       

      private final MessageListener listener5000 = new MessageListener() {

                @Override

                public void onMessage(Message message) {

                          try {

                                    Thread.sleep(5000);

                          } catch (InterruptedException e) {

                                    // TODO Auto-generated catch block

                                    e.printStackTrace();

                          }

                          System.out.println("5000 *********"  + message.toString() );

                }

      };

       

      finally, i removed the below

       

              // Step 14. We now consume those messages on *both* server 0 and server 1.

               // We note the messages have been distributed between servers in a round robin fashion

               // JMS Queues implement point-to-point message where each message is only ever consumed by a

               // maximum of one consumer

       

       

      //         for (int i = 0; i < numMessages; i += 2)

      //         {

      //            TextMessage message0 = (TextMessage)consumer0.receive(5000);

      //

      //            System.out.println("Got message: " + message0.getText() + " from node 0");

      //

      //            TextMessage message1 = (TextMessage)consumer1.receive(5000);

      //

      //            System.out.println("Got message: " + message1.getText() + " from node 1");

      //         }

       

       

      but two error is occcured,

       

       

      1) one error is like below

       

      WARN: HQ214084: Invalid concurrent session usage. Sessions are not supposed to be used by more than one thread concurrently.

      java.lang.Exception: trace

                at org.hornetq.core.client.impl.ClientSessionImpl.startCall(ClientSessionImpl.java:1316)

                at org.hornetq.core.client.impl.ClientSessionImpl.acknowledge(ClientSessionImpl.java:800)

                at org.hornetq.core.client.impl.ClientConsumerImpl.doAck(ClientConsumerImpl.java:1149)

                at org.hornetq.core.client.impl.ClientConsumerImpl.acknowledge(ClientConsumerImpl.java:752)

                at org.hornetq.core.client.impl.ClientMessageImpl.acknowledge(ClientMessageImpl.java:96)

                at org.hornetq.jms.client.JMSMessageListenerWrapper.onMessage(JMSMessageListenerWrapper.java:133)

                at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1016)

                at org.hornetq.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:52)

                at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1161)

                at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:106)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

                at java.lang.Thread.run(Thread.java:722)

       

       

      2) and the other is like below..

       

      ERROR: HQ224079: Bridge Failed to ack

      java.lang.IllegalStateException: Journal must be in state=LOADED, was [STOPPED]

                at org.hornetq.core.journal.impl.JournalImpl.checkJournalIsLoaded(JournalImpl.java:1001)

                at org.hornetq.core.journal.impl.JournalImpl.appendUpdateRecord(JournalImpl.java:824)

                at org.hornetq.core.persistence.impl.journal.JournalStorageManager.storeAcknowledge(JournalStorageManager.java:895)

                at org.hornetq.core.server.impl.QueueImpl.acknowledge(QueueImpl.java:933)

                at org.hornetq.core.server.cluster.impl.BridgeImpl.sendAcknowledged(BridgeImpl.java:476)

                at org.hornetq.core.client.impl.ClientSessionImpl.commandConfirmed(ClientSessionImpl.java:1333)

                at org.hornetq.core.protocol.core.impl.ChannelImpl.clearUpTo(ChannelImpl.java:657)

                at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:586)

                at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:547)

                at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:523)

                at org.hornetq.core.client.impl.ClientSessionFactoryImpl$DelegatingBufferHandler.bufferReceived(ClientSessionFactoryImpl.java:1662)

                at org.hornetq.core.remoting.impl.netty.HornetQChannelHandler.messageReceived(HornetQChannelHandler.java:72)

                at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:95)

                at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)

                at org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:792)

                at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:281)

                at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.decode(HornetQFrameDecoder2.java:169)

                at org.hornetq.core.remoting.impl.netty.HornetQFrameDecoder2.messageReceived(HornetQFrameDecoder2.java:134)

                at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:75)

                at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)

                at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)

                at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268)

                at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255)

                at org.jboss.netty.channel.socket.oio.OioWorker.process(OioWorker.java:72)

                at org.jboss.netty.channel.socket.oio.AbstractOioWorker.run(AbstractOioWorker.java:73)

                at org.jboss.netty.channel.socket.oio.OioWorker.run(OioWorker.java:52)

                at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)

                at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)

                at org.jboss.netty.util.VirtualExecutorService$ChildExecutorRunnable.run(VirtualExecutorService.java:176)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

                at java.lang.Thread.run(Thread.java:722)

       

      and I have last question.

      the listener is asyncronous??  how can I set synchronous listener?

        • 1. Re: clustered-queue example is not working.
          gaohoward

          Are you running the example on Windows platform?

          • 2. Re: clustered-queue example is not working.
            verystrongjoe

            yes, I'm running the example on windows 7 64bit.

            • 3. Re: clustered-queue example is not working.
              ataylor

              ive moved this to the correct forum.

               

              The first trace you can ignore, its a bug when you use the same session to send messages and to receive them.

              • 4. Re: clustered-queue example is not working.
                verystrongjoe

                ok i will ignore first one, but could you let me know about second one? i think it's not the thing ignored.

                • 5. Re: clustered-queue example is not working.
                  gaohoward

                  I'm investigating hornetq examples on Windows, including this issue. I'll give an update soon.

                  • 6. Re: clustered-queue example is not working.
                    gaohoward

                    Update: You can safely ignore the second one.

                     

                    HornetQ cluster uses core-bridges internally to distribute messages of a clustered queue. Each core bridge uses asynchronous send ack when forwarding messages from one node to another. When the test finished and the nodes are shut down, it is possible that a delayed send confirmation request is failed to be processed as the node is alreading shutting down its services. It can cause some messages to be re-sent after node re-start, and the duplication-detection will guarantee that those messages are not delivered twice.

                     

                    If you need more details pls read user manual. (esp Client Reconnection and Session Reattachment)

                     

                    So the failure will be recovered by server automatically.

                     

                    Howard

                    • 7. Re: clustered-queue example is not working.
                      verystrongjoe

                      thanks for the detailed reply. 

                      but one thing I'm wondering is why the bridge uses not synchronous send ack,  but asynchronous send ack.

                      for convincing distributing messaging, the ack message have to be synchronous and the node have to wait until the ack is delivered.?

                      • 8. Re: clustered-queue example is not working.
                        ataylor

                        for performance reasons the bridge acks in batches, if the target server crashes then the bridge will resend any unacked messages on reconnect, once only delivery is gauranteed using duplicate detection

                        • 9. Re: clustered-queue example is not working.
                          dheinzh3

                          Andy -- I'm having the same problem with my logs filling up with as verystrongjoe was last April.

                           

                          10:12:03,797  WARN client:1313 - HQ214021: Invalid concurrent session usage. Sessions are not supposed to be used by more than one thread concurrently.

                          java.lang.Exception: trace

                                  at org.hornetq.core.client.impl.ClientSessionImpl.startCall(ClientSessionImpl.java:1313)

                                  at org.hornetq.core.client.impl.ClientProducerImpl.doSend(ClientProducerImpl.java:215)

                                  at org.hornetq.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:140)

                           

                          I'm using hornetq-2.3.0.Final and have just converted to it this week.  I was using hornetq_2.1

                           

                          What is this Warning?

                          Can it be suppressed?

                          Is it a bug that is fixed?

                          Where can I get the fix?

                           

                          Thank you in advance for the help.


                          Dave