Class MessageCounter


  • public class MessageCounter
    extends Object
    This class stores message count informations for a given queue At intervals this class samples the queue for message count data Note that the underlying queue *does not* update statistics every time a message is added since that would reall slow things down, instead we *sample* the queues at regular intervals - this means we are less intrusive on the queue
    • Constructor Detail

      • MessageCounter

        public MessageCounter​(String name,
                              String subscription,
                              Queue serverQueue,
                              boolean topic,
                              boolean durable,
                              int daycountmax)
        Constructor
        Parameters:
        name - destination name
        subscription - subscription name
        serverQueue - internal queue object
        topic - topic destination flag
        durable - durable subscription flag
        daycountmax - max message history day count
    • Method Detail

      • onTimer

        public void onTimer()
      • getDestinationName

        public String getDestinationName()
      • getDestinationSubscription

        public String getDestinationSubscription()
      • isDestinationTopic

        public boolean isDestinationTopic()
      • isDestinationDurable

        public boolean isDestinationDurable()
      • getCount

        public long getCount()
        Gets the total message count since startup or last counter reset
      • getCountDelta

        public long getCountDelta()
        Gets the message count delta since last method call
      • getMessageCount

        public long getMessageCount()
        Gets the current message count of pending messages within the destination waiting for dispatch
      • getMessageCountDelta

        public long getMessageCountDelta()
        Gets the message count delta of pending messages since last method call.
      • getLastUpdate

        public long getLastUpdate()
      • getLastAddedMessageTime

        public long getLastAddedMessageTime()
      • getLastAckedMessageTime

        public long getLastAckedMessageTime()
      • resetCounter

        public void resetCounter()
      • resetHistory

        public void resetHistory()
      • getHistoryAsString

        public String getHistoryAsString()
        Get message counter history data as string in format "day count\n Date 1, hour counter 0, hour counter 1, ..., hour counter 23\n Date 2, hour counter 0, hour counter 1, ..., hour counter 23\n ..... ..... Date n, hour counter 0, hour counter 1, ..., hour counter 23\n"
        Returns:
        String message history data string
      • toJSon

        public String toJSon()
        Returns a JSON String serialization of a MessageCounter object.
        Returns: