Class MessageCounter
- java.lang.Object
-
- org.apache.activemq.artemis.core.messagecounter.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMessageCounter.DayCounterInternal day counter class for one day hour based counter history
-
Constructor Summary
Constructors Constructor Description MessageCounter(String name, String subscription, Queue serverQueue, boolean topic, boolean durable, int daycountmax)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetCount()Gets the total message count since startup or last counter resetlonggetCountDelta()Gets the message count delta since last method callStringgetDestinationName()StringgetDestinationSubscription()List<MessageCounter.DayCounter>getHistory()StringgetHistoryAsString()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 .....longgetLastAckedMessageTime()longgetLastAddedMessageTime()longgetLastUpdate()longgetMessageCount()Gets the current message count of pending messages within the destination waiting for dispatchlonggetMessageCountDelta()Gets the message count delta of pending messages since last method call.booleanisDestinationDurable()booleanisDestinationTopic()voidonTimer()voidresetCounter()voidresetHistory()StringtoJSon()Returns a JSON String serialization of aMessageCounterobject.StringtoString()
-
-
-
Constructor Detail
-
MessageCounter
public MessageCounter(String name, String subscription, Queue serverQueue, boolean topic, boolean durable, int daycountmax)
Constructor- Parameters:
name- destination namesubscription- subscription nameserverQueue- internal queue objecttopic- topic destination flagdurable- durable subscription flagdaycountmax- 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()
-
getHistory
public List<MessageCounter.DayCounter> getHistory()
-
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 aMessageCounterobject.- Returns:
-
-