3 Replies Latest reply on Nov 23, 2015 2:41 AM by Alfred Holzinger

    Monitoring JMS Queue - timestamp of first message

    Alfred Holzinger Newbie

      We are currently embedding HornetQ 2.3.15 in our applications. It works well.

      We are planning to migrate to ActiveMQ Artemis soon.

       

      For JMS queue monitoring purpose, we have implemented to list and verify

      (a) the number of messages and

      (b) the timestamp of the first message in the queue(s).

       

      What is the recommended approach to identify the timestamp of the first message in a JMS queue?

       

      We have tried the following 2 approaches:

      1. QueueControl.listmessages, get the JMSTimestamp property of the first message

      Pro: Works well in a read only/browser mode

      Con: Very slow for large queues. Our tests were more than 3 minutes on a Queue with 500.000 Messages.

       

      2. consume the first message, get the JMSTimestamp property and rollback the session (in this way we do not consume the message within the monitoring task)

      Pro: Very fast

      Con: A multiple rollback on the same message will cause the message to be moved to the Dead Letter Queue. This is not acceptable.

       

      We have currently implemented the 2nd approach. However if the first message are not consumed for some time, it causes the message to be redirected to the DLQ after the monitoring has verified this 10 times (Default for DLQ redirection). This is not a wanted feature.

       

      What would you recommend?

      Our requirement is to monitor the number of messages and the timestamp of the first message in a JMS Queue.