org.apache.activemq.broker.region
Interface Subscription

All Known Implementing Classes:
AbstractSubscription, DurableTopicSubscription, PrefetchSubscription, QueueBrowserSubscription, QueueSubscription, TopicSubscription

public interface Subscription

Version:
$Revision: 1.5 $

Method Summary
 void acknowledge(ConnectionContext context, MessageAck ack)
          Used when client acknowledge receipt of dispatched message.
 void add(ConnectionContext context, Destination destination)
          The subscription will be receiving messages from the destination.
 void add(MessageReference node)
          Used to add messages that match the subscription.
 void destroy()
          Called when the subscription is destroyed.
 void gc()
          The subscription should release as may references as it can to help the garbage collector reclaim memory.
 ConsumerInfo getConsumerInfo()
          The ConsumerInfo object that created the subscription.
 long getDequeueCounter()
           
 long getDispatchedCounter()
           
 int getDispatchedQueueSize()
           
 long getEnqueueCounter()
           
 javax.management.ObjectName getObjectName()
           
 int getPendingQueueSize()
           
 int getPrefetchSize()
           
 java.lang.String getSelector()
           
 boolean isHighWaterMark()
           
 boolean isLowWaterMark()
           
 boolean isRecoveryRequired()
          Informs the Broker if the subscription needs to intervention to recover it's state e.g.
 boolean isSlaveBroker()
           
 boolean matches(ActiveMQDestination destination)
          Is the subscription interested in messages in the destination?
 boolean matches(MessageReference node, MessageEvaluationContext context)
          Is the subscription interested in the message?
 void optimizePrefetch()
          optimize message consumer prefetch if the consumer supports it
 void processMessageDispatchNotification(MessageDispatchNotification mdn)
          Used by a Slave Broker to update dispatch infomation
 Response pullMessage(ConnectionContext context, MessagePull pull)
          Allows a consumer to pull a message on demand
 void remove(ConnectionContext context, Destination destination)
          The subscription will be no longer be receiving messages from the destination.
 void setObjectName(javax.management.ObjectName objectName)
          Set when the subscription is registered in JMX
 void setSelector(java.lang.String selector)
          Attempts to change the current active selector on the subscription.
 void updateConsumerPrefetch(int newPrefetch)
          inform the MessageConsumer on the client to change it's prefetch
 

Method Detail

add

void add(MessageReference node)
         throws java.lang.Exception
Used to add messages that match the subscription.

Parameters:
node -
Throws:
java.lang.InterruptedException
java.io.IOException
java.lang.Exception

acknowledge

void acknowledge(ConnectionContext context,
                 MessageAck ack)
                 throws java.lang.Exception
Used when client acknowledge receipt of dispatched message.

Parameters:
node -
Throws:
java.io.IOException
java.lang.Exception

pullMessage

Response pullMessage(ConnectionContext context,
                     MessagePull pull)
                     throws java.lang.Exception
Allows a consumer to pull a message on demand

Throws:
java.lang.Exception

matches

boolean matches(MessageReference node,
                MessageEvaluationContext context)
                throws java.io.IOException
Is the subscription interested in the message?

Parameters:
node -
context -
Returns:
Throws:
java.io.IOException

matches

boolean matches(ActiveMQDestination destination)
Is the subscription interested in messages in the destination?

Parameters:
context -
Returns:

add

void add(ConnectionContext context,
         Destination destination)
         throws java.lang.Exception
The subscription will be receiving messages from the destination.

Parameters:
context -
destination -
Throws:
java.lang.Exception

remove

void remove(ConnectionContext context,
            Destination destination)
            throws java.lang.Exception
The subscription will be no longer be receiving messages from the destination.

Parameters:
context -
destination -
Throws:
java.lang.Exception

getConsumerInfo

ConsumerInfo getConsumerInfo()
The ConsumerInfo object that created the subscription.

Parameters:
destination -

gc

void gc()
The subscription should release as may references as it can to help the garbage collector reclaim memory.


processMessageDispatchNotification

void processMessageDispatchNotification(MessageDispatchNotification mdn)
                                        throws java.lang.Exception
Used by a Slave Broker to update dispatch infomation

Parameters:
mdn -
Throws:
java.lang.Exception

isSlaveBroker

boolean isSlaveBroker()
Returns:
true if the broker is currently in slave mode

getPendingQueueSize

int getPendingQueueSize()
Returns:
number of messages pending delivery

getDispatchedQueueSize

int getDispatchedQueueSize()
Returns:
number of messages dispatched to the client

getDispatchedCounter

long getDispatchedCounter()
Returns:
number of messages dispatched to the client

getEnqueueCounter

long getEnqueueCounter()
Returns:
number of messages that matched the subscription

getDequeueCounter

long getDequeueCounter()
Returns:
number of messages queued by the client

getSelector

java.lang.String getSelector()
Returns:
the JMS selector on the current subscription

setSelector

void setSelector(java.lang.String selector)
                 throws javax.jms.InvalidSelectorException,
                        java.lang.UnsupportedOperationException
Attempts to change the current active selector on the subscription. This operation is not supported for persistent topics.

Throws:
javax.jms.InvalidSelectorException
java.lang.UnsupportedOperationException

getObjectName

javax.management.ObjectName getObjectName()
Returns:
the JMX object name that this subscription was registered as if applicable

setObjectName

void setObjectName(javax.management.ObjectName objectName)
Set when the subscription is registered in JMX


isLowWaterMark

boolean isLowWaterMark()
Returns:
true when 60% or more room is left for dispatching messages

isHighWaterMark

boolean isHighWaterMark()
Returns:
true when 10% or less room is left for dispatching messages

updateConsumerPrefetch

void updateConsumerPrefetch(int newPrefetch)
inform the MessageConsumer on the client to change it's prefetch

Parameters:
newPrefetch -

optimizePrefetch

void optimizePrefetch()
optimize message consumer prefetch if the consumer supports it


destroy

void destroy()
Called when the subscription is destroyed.


getPrefetchSize

int getPrefetchSize()
Returns:
the prefetch size that is configured for the subscription

isRecoveryRequired

boolean isRecoveryRequired()
Informs the Broker if the subscription needs to intervention to recover it's state e.g. DurableTopicSubscriber may do

Returns:
true if recovery required
See Also:
org.apache.activemq.region.cursors.PendingMessageCursor


Copyright © 2009 Apache Software Foundation. All Rights Reserved.