org.apache.activemq.broker.region
Class DurableTopicSubscription

java.lang.Object
  extended by org.apache.activemq.broker.region.AbstractSubscription
      extended by org.apache.activemq.broker.region.PrefetchSubscription
          extended by org.apache.activemq.broker.region.DurableTopicSubscription
All Implemented Interfaces:
Subscription

public class DurableTopicSubscription
extends PrefetchSubscription


Field Summary
 
Fields inherited from class org.apache.activemq.broker.region.PrefetchSubscription
dispatched, pending, prefetchExtension
 
Fields inherited from class org.apache.activemq.broker.region.AbstractSubscription
broker, context, destinationFilter, info
 
Constructor Summary
DurableTopicSubscription(Broker broker, ConnectionContext context, ConsumerInfo info, boolean keepDurableSubsActive, PendingMessageCursor cursor)
           
 
Method Summary
protected  void acknowledge(ConnectionContext context, MessageAck ack, MessageReference node)
          Used during acknowledgment to remove the message.
 void activate(ConnectionContext context, ConsumerInfo info)
           
 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.
protected  boolean canDispatch(MessageReference node)
          Use when a matched message is about to be dispatched to the client.
protected  MessageDispatch createMessageDispatch(MessageReference node, Message message)
           
 void deactivate(boolean keepDurableSubsActive)
           
 void destroy()
          Release any references that we are holding.
 void gc()
          The subscription should release as may references as it can to help the garbage collector reclaim memory.
 java.lang.String getClientId()
           
 int getPendingQueueSize()
           
 SubscriptionKey getSubscriptionKey()
           
 java.lang.String getSubscriptionName()
           
 boolean isActive()
           
protected  boolean isFull()
          Used to determine if the broker can dispatch to the consumer.
 void setSelector(java.lang.String selector)
          Attempts to change the current active selector on the subscription.
 java.lang.String toString()
           
 
Methods inherited from class org.apache.activemq.broker.region.PrefetchSubscription
acknowledge, dispatch, dispatchMatched, getDequeueCounter, getDispatchedCounter, getDispatchedQueueSize, getEnqueueCounter, isHighWaterMark, isLowWaterMark, isRecoveryRequired, onDispatch, optimizePrefetch, processMessageDispatchNotification, pullMessage, remove, sendToDLQ, updateConsumerPrefetch
 
Methods inherited from class org.apache.activemq.broker.region.AbstractSubscription
getConsumerInfo, getContext, getInfo, getObjectName, getPrefetchSize, getSelector, getSelectorExpression, isSlaveBroker, matches, matches, setObjectName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DurableTopicSubscription

public DurableTopicSubscription(Broker broker,
                                ConnectionContext context,
                                ConsumerInfo info,
                                boolean keepDurableSubsActive,
                                PendingMessageCursor cursor)
                         throws javax.jms.InvalidSelectorException
Throws:
javax.jms.InvalidSelectorException
Method Detail

isActive

public boolean isActive()

isFull

protected boolean isFull()
Description copied from class: PrefetchSubscription
Used to determine if the broker can dispatch to the consumer.

Overrides:
isFull in class PrefetchSubscription
Returns:

gc

public void gc()
Description copied from interface: Subscription
The subscription should release as may references as it can to help the garbage collector reclaim memory.

Specified by:
gc in interface Subscription
Overrides:
gc in class AbstractSubscription

add

public void add(ConnectionContext context,
                Destination destination)
         throws java.lang.Exception
Description copied from interface: Subscription
The subscription will be receiving messages from the destination.

Specified by:
add in interface Subscription
Overrides:
add in class PrefetchSubscription
Throws:
java.lang.Exception

activate

public void activate(ConnectionContext context,
                     ConsumerInfo info)
              throws java.lang.Exception
Throws:
java.lang.Exception

deactivate

public void deactivate(boolean keepDurableSubsActive)
                throws java.lang.Exception
Throws:
java.lang.Exception

createMessageDispatch

protected MessageDispatch createMessageDispatch(MessageReference node,
                                                Message message)
Overrides:
createMessageDispatch in class PrefetchSubscription
Returns:
MessageDispatch

add

public void add(MessageReference node)
         throws java.lang.Exception
Description copied from interface: Subscription
Used to add messages that match the subscription.

Specified by:
add in interface Subscription
Overrides:
add in class PrefetchSubscription
Throws:
java.lang.InterruptedException
java.io.IOException
java.lang.Exception

getPendingQueueSize

public int getPendingQueueSize()
Specified by:
getPendingQueueSize in interface Subscription
Overrides:
getPendingQueueSize in class PrefetchSubscription
Returns:
number of messages pending delivery

setSelector

public void setSelector(java.lang.String selector)
                 throws javax.jms.InvalidSelectorException
Description copied from interface: Subscription
Attempts to change the current active selector on the subscription. This operation is not supported for persistent topics.

Specified by:
setSelector in interface Subscription
Overrides:
setSelector in class AbstractSubscription
Throws:
javax.jms.InvalidSelectorException

canDispatch

protected boolean canDispatch(MessageReference node)
Description copied from class: PrefetchSubscription
Use when a matched message is about to be dispatched to the client.

Specified by:
canDispatch in class PrefetchSubscription
Returns:
false if the message should not be dispatched to the client (another sub may have already dispatched it for example).

acknowledge

protected void acknowledge(ConnectionContext context,
                           MessageAck ack,
                           MessageReference node)
                    throws java.io.IOException
Description copied from class: PrefetchSubscription
Used during acknowledgment to remove the message.

Overrides:
acknowledge in class PrefetchSubscription
Throws:
java.io.IOException

getSubscriptionName

public java.lang.String getSubscriptionName()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getClientId

public java.lang.String getClientId()

getSubscriptionKey

public SubscriptionKey getSubscriptionKey()

destroy

public void destroy()
Release any references that we are holding.



Copyright © 2009 Apache Software Foundation. All Rights Reserved.