Package org.apache.activemq.broker.jmx
Class SubscriptionView
- java.lang.Object
-
- org.apache.activemq.broker.jmx.SubscriptionView
-
- All Implemented Interfaces:
SubscriptionViewMBean
- Direct Known Subclasses:
DurableSubscriptionView
,TopicSubscriptionView
public class SubscriptionView extends Object implements SubscriptionViewMBean
-
-
Field Summary
Fields Modifier and Type Field Description protected String
clientId
protected Subscription
subscription
protected String
userName
-
Constructor Summary
Constructors Constructor Description SubscriptionView(String clientId, String userName, Subscription subs)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
gc()
The subscription should release as may references as it can to help the garbage collector reclaim memory.String
getClientId()
ObjectName
getConnection()
Returns the ObjectName of the Connection that created this Subscription.String
getConnectionId()
long
getConsumedCount()
protected ConsumerInfo
getConsumerInfo()
long
getDequeueCounter()
String
getDestinationName()
long
getDispatchedCounter()
int
getDispatchedQueueSize()
long
getEnqueueCounter()
int
getMaximumPendingMessageLimit()
int
getMessageCountAwaitingAcknowledge()
The same as the number of messages dispatched - making it explicitint
getPendingQueueSize()
int
getPrefetchSize()
byte
getPriority()
String
getSelector()
long
getSessionId()
long
getSubscriptionId()
String
getSubscriptionName()
String
getUserName()
Returns the User Name used to authorize creation of this Subscription.boolean
isActive()
boolean
isDestinationQueue()
boolean
isDestinationTemporary()
boolean
isDestinationTopic()
boolean
isDispatchAsync()
boolean
isDurable()
boolean
isExclusive()
boolean
isMatchingQueue(String queueName)
Returns true if this subscription (which may be using wildcards) matches the given queue nameboolean
isMatchingTopic(String topicName)
Returns true if this subscription (which may be using wildcards) matches the given topic nameboolean
isNetwork()
boolean
isNoLocal()
boolean
isRetroactive()
boolean
isSlowConsumer()
Returns true if the subscription is slowboolean
matchesDestination(ActiveMQDestination destination)
Return true if this subscription matches the given destinationvoid
resetStatistics()
void
setSelector(String selector)
Attempts to change the current active selector on the subscription.String
toString()
-
-
-
Field Detail
-
subscription
protected final Subscription subscription
-
clientId
protected final String clientId
-
userName
protected final String userName
-
-
Constructor Detail
-
SubscriptionView
public SubscriptionView(String clientId, String userName, Subscription subs)
Constructor- Parameters:
subs
-
-
-
Method Detail
-
getClientId
public String getClientId()
- Specified by:
getClientId
in interfaceSubscriptionViewMBean
- Returns:
- the clientId
-
getConnection
public ObjectName getConnection()
Description copied from interface:SubscriptionViewMBean
Returns the ObjectName of the Connection that created this Subscription. This value can be null if for instance this is an off-line durable subscription.- Specified by:
getConnection
in interfaceSubscriptionViewMBean
- Returns:
- the name of the Connection that created this Subscription.
-
getConnectionId
public String getConnectionId()
- Specified by:
getConnectionId
in interfaceSubscriptionViewMBean
- Returns:
- the id of the Connection the Subscription is on
-
getSessionId
public long getSessionId()
- Specified by:
getSessionId
in interfaceSubscriptionViewMBean
- Returns:
- the id of the Session the subscription is on
-
getSubscriptionId
public long getSubscriptionId()
- Specified by:
getSubscriptionId
in interfaceSubscriptionViewMBean
- Returns:
- the id of the Subscription
-
getDestinationName
public String getDestinationName()
- Specified by:
getDestinationName
in interfaceSubscriptionViewMBean
- Returns:
- the destination name
-
getSelector
public String getSelector()
- Specified by:
getSelector
in interfaceSubscriptionViewMBean
- Returns:
- the JMS selector on the current subscription
-
setSelector
public void setSelector(String selector) throws InvalidSelectorException, UnsupportedOperationException
Description copied from interface:SubscriptionViewMBean
Attempts to change the current active selector on the subscription. This operation is not supported for persistent topics.- Specified by:
setSelector
in interfaceSubscriptionViewMBean
- Throws:
InvalidSelectorException
UnsupportedOperationException
-
isDestinationQueue
public boolean isDestinationQueue()
- Specified by:
isDestinationQueue
in interfaceSubscriptionViewMBean
- Returns:
- true if the destination is a Queue
-
isDestinationTopic
public boolean isDestinationTopic()
- Specified by:
isDestinationTopic
in interfaceSubscriptionViewMBean
- Returns:
- true of the destination is a Topic
-
isDestinationTemporary
public boolean isDestinationTemporary()
- Specified by:
isDestinationTemporary
in interfaceSubscriptionViewMBean
- Returns:
- true if the destination is temporary
-
isActive
public boolean isActive()
- Specified by:
isActive
in interfaceSubscriptionViewMBean
- Returns:
- true if the subscriber is active
-
isNetwork
public boolean isNetwork()
- Specified by:
isNetwork
in interfaceSubscriptionViewMBean
-
gc
public void gc()
The subscription should release as may references as it can to help the garbage collector reclaim memory.
-
isRetroactive
public boolean isRetroactive()
- Specified by:
isRetroactive
in interfaceSubscriptionViewMBean
- Returns:
- whether or not the subscriber is retroactive or not
-
isExclusive
public boolean isExclusive()
- Specified by:
isExclusive
in interfaceSubscriptionViewMBean
- Returns:
- whether or not the subscriber is an exclusive consumer
-
isDurable
public boolean isDurable()
- Specified by:
isDurable
in interfaceSubscriptionViewMBean
- Returns:
- whether or not the subscriber is durable (persistent)
-
isNoLocal
public boolean isNoLocal()
- Specified by:
isNoLocal
in interfaceSubscriptionViewMBean
- Returns:
- whether or not the subscriber ignores local messages
-
isDispatchAsync
public boolean isDispatchAsync()
- Specified by:
isDispatchAsync
in interfaceSubscriptionViewMBean
- Returns:
- whether or not the subscriber is configured for async dispatch
-
getMaximumPendingMessageLimit
public int getMaximumPendingMessageLimit()
- Specified by:
getMaximumPendingMessageLimit
in interfaceSubscriptionViewMBean
- Returns:
- the maximum number of pending messages allowed in addition to the prefetch size. If enabled to a non-zero value then this will perform eviction of messages for slow consumers on non-durable topics.
-
getPriority
public byte getPriority()
- Specified by:
getPriority
in interfaceSubscriptionViewMBean
- Returns:
- the consumer priority
-
getSubscriptionName
public String getSubscriptionName()
- Specified by:
getSubscriptionName
in interfaceSubscriptionViewMBean
- Returns:
- the name of the consumer which is only used for durable consumers.
-
getPendingQueueSize
public int getPendingQueueSize()
- Specified by:
getPendingQueueSize
in interfaceSubscriptionViewMBean
- Returns:
- number of messages pending delivery
-
getDispatchedQueueSize
public int getDispatchedQueueSize()
- Specified by:
getDispatchedQueueSize
in interfaceSubscriptionViewMBean
- Returns:
- number of messages dispatched
-
getMessageCountAwaitingAcknowledge
public int getMessageCountAwaitingAcknowledge()
Description copied from interface:SubscriptionViewMBean
The same as the number of messages dispatched - making it explicit- Specified by:
getMessageCountAwaitingAcknowledge
in interfaceSubscriptionViewMBean
- Returns:
- number of messages waiting for an acknowledge.
-
getDispatchedCounter
public long getDispatchedCounter()
- Specified by:
getDispatchedCounter
in interfaceSubscriptionViewMBean
- Returns:
- number of messages that matched the subscription
-
getEnqueueCounter
public long getEnqueueCounter()
- Specified by:
getEnqueueCounter
in interfaceSubscriptionViewMBean
- Returns:
- number of messages that matched the subscription
-
getDequeueCounter
public long getDequeueCounter()
- Specified by:
getDequeueCounter
in interfaceSubscriptionViewMBean
- Returns:
- number of messages queued by the client
-
getConsumerInfo
protected ConsumerInfo getConsumerInfo()
-
getPrefetchSize
public int getPrefetchSize()
- Specified by:
getPrefetchSize
in interfaceSubscriptionViewMBean
- Returns:
- the prefetch that has been configured for this subscriber
-
isMatchingQueue
public boolean isMatchingQueue(String queueName)
Description copied from interface:SubscriptionViewMBean
Returns true if this subscription (which may be using wildcards) matches the given queue name- Specified by:
isMatchingQueue
in interfaceSubscriptionViewMBean
- Parameters:
queueName
- the JMS queue name to match against- Returns:
- true if this subscription matches the given queue or false if not
-
isMatchingTopic
public boolean isMatchingTopic(String topicName)
Description copied from interface:SubscriptionViewMBean
Returns true if this subscription (which may be using wildcards) matches the given topic name- Specified by:
isMatchingTopic
in interfaceSubscriptionViewMBean
- Parameters:
topicName
- the JMS topic name to match against- Returns:
- true if this subscription matches the given topic or false if not
-
matchesDestination
public boolean matchesDestination(ActiveMQDestination destination)
Return true if this subscription matches the given destination- Parameters:
destination
- the destination to compare against- Returns:
- true if this subscription matches the given destination
-
isSlowConsumer
public boolean isSlowConsumer()
Description copied from interface:SubscriptionViewMBean
Returns true if the subscription is slow- Specified by:
isSlowConsumer
in interfaceSubscriptionViewMBean
- Returns:
- true if the subscription is slow
-
getUserName
public String getUserName()
Description copied from interface:SubscriptionViewMBean
Returns the User Name used to authorize creation of this Subscription. This value can be null if display of user name information is disabled.- Specified by:
getUserName
in interfaceSubscriptionViewMBean
- Returns:
- the name of the user that created this Subscription
-
resetStatistics
public void resetStatistics()
- Specified by:
resetStatistics
in interfaceSubscriptionViewMBean
-
getConsumedCount
public long getConsumedCount()
- Specified by:
getConsumedCount
in interfaceSubscriptionViewMBean
-
-