12 Replies Latest reply on Nov 23, 2010 11:52 PM by matt.u

    Always received the duplicate message.

    matt.u

      I always received the duplicate message on the HornetQ-2.1.2 what ever the  client manual acknowledge mode/preacknowledge mode or transaction mode.

       

      I have no idea to resolve this problem.So please.

       

      Thanks.

        • 1. Re: Always received the duplicate message.
          clebert.suconic

          On your example, you set autoCommitACK to false, and pre-ack to true.

           

          on that case you must call commit to complete the request. The messages are being acked but buffered on a TX at the server's.

           

          another possibility is to set autoCommitACK=true, and set ACKBatchSize = 0

           

          you always have to call msg.Acknowledge if you don't set preACK.

          • 2. Re: Always received the duplicate message.
            matt.u

            I try to set the autoCommitAck = true and AckBatchSize = 0 and the preAck = true, but I still get the duplicate message.

            Can you test my example? I modified it like this, is this wrong?

             

            sessionFactory = HornetQClient.createClientSessionFactory(new TransportConfiguration(
                            InVMConnectorFactory.class.getName()));
                        sessionFactory.setAckBatchSize(0);
                        sessionFactory.setBlockOnAcknowledge(true);
                        session = sessionFactory.createSession(true, true, true, true);
                        consumer = session.createConsumer("query.exampleQueue");
                        producer = session.createProducer("query.exampleQueue");
                        session.start();

            • 3. Re: Always received the duplicate message.
              ataylor

              your also using XA, so even tho your using pre ck you will need to commit the session

              • 4. Re: Always received the duplicate message.
                matt.u

                When I commit the session, the problem is still, when i received all the messages and restart the app, there will receive som duplilicate messages.

                I always get the warning:Duplicate message detected - transaction will be rejected.I feel this will slow down the app.

                 

                And I get the exception when first commit session.I thining maybe the ACKBatchSize = 0 so there is no message.

                Sending unexpected exception to the client
                java.lang.NullPointerException
                    at org.hornetq.core.server.impl.ServerSessionImpl.commit(ServerSessionImpl.java:542)
                    at org.hornetq.core.protocol.core.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:306)
                    at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:471)
                    at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:451)
                    at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl.access$000(RemotingConnectionImpl.java:43)
                    at org.hornetq.core.protocol.core.impl.RemotingConnectionImpl$1.run(RemotingConnectionImpl.java:391)
                    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
                    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
                    at java.lang.Thread.run(Unknown Source)
                HornetQException[errorCode=0 message=null]
                    at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:287)
                    at org.hornetq.core.client.impl.ClientSessionImpl.commit(ClientSessionImpl.java:514)
                    at org.hornetq.core.client.impl.DelegatingSession.commit(DelegatingSession.java:156)
                    at ReceiveMessageThread.receiveMessage(ReceiveMessageThread.java:42)
                    at ReceiveMessageThread.run(ReceiveMessageThread.java:13)

                • 5. Re: Always received the duplicate message.
                  clebert.suconic

                  There are tons of examples on the distribution... just RTFM.

                   

                  If you use XA, you need to use to a TM, or you enlist stuff properly, otherwise you will get NPEs as  you didn't enlist XIDs.

                  • 6. Re: Always received the duplicate message.
                    matt.u

                    If i don't use XA, should I deal with the duplicate message myself?

                    I only wan't the most message persisent and allow less message miss when power off but not duplicate message.So I want use preacknowledge mode,

                    • 7. Re: Always received the duplicate message.
                      clebert.suconic

                      That's the point.. you set your session to XA.. did you read our previous message?

                       

                       

                      When you set your session like this:

                       

                      session = sessionFactory.createSession(true, true, true, true);

                       

                       

                      (the first true is XA=true)...

                       

                      you're supposed to use XA if you set the first parameter as true.

                       

                       

                       

                      I'm telling you use false, true, true, true

                      • 8. Re: Always received the duplicate message.
                        matt.u

                        I use the setting "false, true, true, true", and I still get the warning "duplicate message".

                        And when I restart my app I still receive many duplicate message.But last time I have received all the message all ready.

                         

                        Can you give a right exmple for me.

                        Thansk.

                        • 9. Re: Always received the duplicate message.
                          matt.u

                          I want try to avoid receive the duplicate message warning,

                          This is slow down my app.

                          • 10. Re: Always received the duplicate message.
                            matt.u

                            When I use the standalone HornetQ server, it seem like the problem is gone.

                            • 11. Re: Always received the duplicate message.
                              clebert.suconic

                              There are many examples... please.. just read the manual and look at the examples.

                               

                              you wrote this: "Can you give a right exmple for me."

                               

                              what else do you want us to do? We can't write the code for you.

                               

                              Just use createSession(xa=false, auto-commit-delivery=true, auto-commit-ack-true, pre-ack=true)

                              • 12. Re: Always received the duplicate message.
                                matt.u

                                Thanks for your reply.

                                I have use createSession(xa=false, auto-commit-delivery=true, auto-commit-ack-true, pre-ack=true) already, but the problem is still exists in VM mode.

                                When I use the standalone HornetQ Server, the problem is gone.

                                 

                                Maybe there is some setting wrong, I will make more test.