1 2 Previous Next 18 Replies Latest reply on Feb 8, 2016 2:58 AM by Marc Anthony Puca

    Last value queue and delivery delay

    Marc Anthony Puca Newbie

      Hi Everyone

       

      Sorry for the silly question, but is there any issue in defining a last value queue and submitting messages with a delivery delay, I mean will this cause any type of conflict?

       

      I have the setting for my queue as

       

      <address-setting match="my queue">

                              <redelivery-delay>60000</redelivery-delay>

                              <max-delivery-attempts>10</max-delivery-attempts>

                              <last-value-queue>true</last-value-queue>

                          </address-setting>

       

       

      but when a submit a message with

       

      jmsContext.createProducer().setDeliveryDelay(60000).send(......)

       

      it does not appear to be delivered until I reboot the app server (Wildfly 9.0.1)

       

      Thanks

       

      Marc

        • 1. Re: Last value queue and delivery delay
          Justin Bertram Master

          I wouldn't expect any kind of conflict.  I just modified the last-value-queue example to send just 1 message with a delivery delay of 10 seconds and changed the consumer to wait for 15 seconds.  Everything worked as expected.

          • 2. Re: Last value queue and delivery delay
            Marc Anthony Puca Newbie

            Hi Justin

            Thanks for the reply, I have tried again but nothing, the first message does not get delivered, and if I submit a second one I get this

             

            08:51:15,709 ERROR [org.hornetq.core.server] (Thread-21 (HornetQ-server-HornetQServerImpl::serverUUID=533483a7-6824-11e5-a9e6-973b3b557249-236013436)) HQ224038: Failed to ack old reference: java.lang.IllegalStateException: Cannot find add info 953482853915

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

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

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

              at org.hornetq.core.server.impl.MessageReferenceImpl.acknowledge(MessageReferenceImpl.java:170)

              at org.hornetq.core.server.impl.LastValueQueue.addTail(LastValueQueue.java:94)

              at org.hornetq.core.postoffice.impl.PostOfficeImpl$AddOperation.afterCommit(PostOfficeImpl.java:1438)

              at org.hornetq.core.transaction.impl.TransactionImpl.afterCommit(TransactionImpl.java:453)

              at org.hornetq.core.transaction.impl.TransactionImpl.access$100(TransactionImpl.java:46)

              at org.hornetq.core.transaction.impl.TransactionImpl$2.done(TransactionImpl.java:282)

              at org.hornetq.core.persistence.impl.journal.OperationContextImpl$1.run(OperationContextImpl.java:233)

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

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

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

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

             

            I submit the message using injected queue and context from another MDB.

             

            ObjectMessage o = myJMSContext.createObjectMessage(myObject);

            o.setStringProperty("_HQ_LVQ_NAME", "my value");

                       

            long delay = 60000l;

                       

            myJMSContext.createProducer().setDeliveryDelay(delay).send(myQueue, o);

             

             

            In the wildfly console I can see the message

             

             

            Queue Metrics

            Consumer Count2
            Message Count1
            Messages Added1
            Scheduled Count0

             

            If I add more messages the count stays in line with the unique last value passed with the message but no delivery takes place unless I restart the server.

             

            Any suggestions

             

            Thanks

             

            Marc

            • 3. Re: Last value queue and delivery delay
              Justin Bertram Master

              Could you provide me with a test-case so I can reproduce what you're seeing for myself? Or could you at least try this on the latest CR of Wildfly 10?

              • 4. Re: Last value queue and delivery delay
                Marc Anthony Puca Newbie

                Hi Justin

                 

                sorry for the delay, I have put together a simple ejb module that highlights the beahaviour, I have notiiced that if I don't set the

                 

                setStringProperty("_HQ_LVQ_NAME", "lastone");

                 

                then all works fine, but obviously does not behave like a LVQ.

                 

                Sorry for the question but how can I attach the files?

                 

                Thanks

                Marc

                • 5. Re: Last value queue and delivery delay
                  Justin Bertram Master

                  When you compose a message on the forum there is a link near the top right of the text-box that says "Use advanced editor."  You can attach files using the advanced editor.

                   

                  Is this EJB module something I can build/deploy/test easily?

                  • 6. Re: Last value queue and delivery delay
                    Marc Anthony Puca Newbie

                    Hi Justin

                     

                         I can't see the advanced editor link so I just put the files on drive

                     

                         https://drive.google.com/file/d/0B8t1bCihM-26R0dnbjFrODlxY1U/view?usp=sharing

                     

                    It contains the ejb module with the source code and standalone config for wildfly 9.0.1

                     

                    If you drop the files in a clean install of Wildfly 9.0.1 you will notice that 5 mesages are submitted and none delivered. The source is there so you can play around/tweak if necessary

                     

                    thanks

                     

                    Marc

                    • 7. Re: Last value queue and delivery delay
                      Justin Bertram Master

                      Thanks for the test-case.  I've written a similar test upstream in Apache Artemis and it is failing as well.  Apparently scheduled messages with an LVQ isn't currently supported.  Can you provide me with more details about your use-case so I can understand it better?  Scheduled messages with an LVQ seems a bit odd to me.

                       

                      Also, I found an unrelated problem with the LVQ example that I was using previously.  It's failing now too with scheduled messages.

                      • 8. Re: Last value queue and delivery delay
                        Marc Anthony Puca Newbie

                        The idea is to collate all changes to a given set of related entities within a time-span and then produce a report. E.g. I submit a message to the queue when i detect a change, ideally if no other changes are made to related entities within the specified delay then the report is produced.

                         

                        So the last value queue will keep track of the latest change only, and the delayed delivery gives me the window.

                         

                        Hopefully I have explained in an understandable way.

                         

                        Thanks

                        Marc

                        • 9. Re: Last value queue and delivery delay
                          Justin Bertram Master

                          Your use-case makes sense to me.  Thanks for the explanation. 

                           

                          I'm currently looking for a way to implement this in Apache ActiveMQ Artemis.  In case you didn't know, about a year and a half ago the HornetQ code-base was donated to Apache ActiveMQ and has morphed into Apache ActiveMQ Artemis.  No further development will be done on HornetQ as all work is being focused on Artemis.  To be clear, Wildfly 10 is integrating Artemis now rather than HornetQ.

                          • 10. Re: Last value queue and delivery delay
                            Marc Anthony Puca Newbie

                            I read about the change in the release notes of Wildfly 10, that said quick question: I have 2 instances of Wildfy (9.0.1 and  8.2.0) on different machines one of which has a queue (8.2.0) and the other has the consumers, If I was to update the consumer AS (9.0.1) to wildfly 10 would it still work or would they both need to use ActiveMQ

                             

                            Thanks

                            Marc

                            • 11. Re: Last value queue and delivery delay
                              Justin Bertram Master

                              Newer clients connecting to an older server isn't typical, but I'd say it's likely to work.  Artemis will definitely support older HornetQ clients.

                              • 12. Re: Last value queue and delivery delay
                                Justin Bertram Master

                                I created https://issues.apache.org/jira/browse/ARTEMIS-374 for this.  However, I don't think it's going to fit your use-case perfectly because when a scheduled message is sent to a queue in HornetQ/Artemis the first thing that happens is the message is given to the scheduler.  In other words, it does not hit the queue until the scheduled time.  In this case, that's when the LVQ logic would be applied.  So, for example, if you sent a message A with a delivery delay of 5 seconds and then 4 seconds later you sent message B with a delivery delay of 5 seconds then 1 second later message A would be put on the queue and then 4 seconds later message B would replace message A.

                                • 13. Re: Last value queue and delivery delay
                                  Marc Anthony Puca Newbie

                                  I understand the logic, I guess it makes sense, unfortunately not applicable to my case . They only way the LVQ would kick-in is if the messages were actually in the queue together which could occur during heavy load on the system.

                                   

                                  Thanks for the help

                                  Marc

                                  • 14. Re: Last value queue and delivery delay
                                    Marc Anthony Puca Newbie

                                    Could you point me towards some documentation for migrating my hornetq config under wildfly 9 to activemq in wildfly 10

                                    Thanks

                                    Marc

                                    1 2 Previous Next