Class MessageCounter
java.lang.Object
org.apache.activemq.artemis.core.messagecounter.MessageCounter
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 ClassesModifier and TypeClassDescriptionstatic final classInternal day counter class for one day hour based counter history -
Constructor Summary
ConstructorsConstructorDescriptionMessageCounter(String name, String subscription, Queue serverQueue, boolean topic, boolean durable, int daycountmax) Constructor -
Method Summary
Modifier and TypeMethodDescriptionlonggetCount()Gets the total message count since startup or last counter resetlongGets the message count delta since last method callGet message counter history data as string in formatlonglonglonglongGets the current message count of pending messages within the destination waiting for dispatchlongGets the message count delta of pending messages since last method call.booleanbooleanvoidonTimer()This method is called periodically to update statistics from the queuevoidvoidtoJSon()Returns a JSON String serialization of aMessageCounterobject.toString()
-
Constructor Details
-
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 Details
-
onTimer
public void onTimer()This method is called periodically to update statistics from the queue -
getDestinationName
-
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
-
getHistoryAsString
Get message counter history data as string in formatday count Date 1, hour counter 0, hour counter 1, ..., hour counter 23 Date 2, hour counter 0, hour counter 1, ..., hour counter 23 ..... ..... Date n, hour counter 0, hour counter 1, ..., hour counter 23
- Returns:
- String message history data string
-
toString
-
toJSon
Returns a JSON String serialization of aMessageCounterobject.- Returns:
- a JSON String serialization of a
MessageCounterobject
-