org.activemq.service
Interface Subscription

All Known Implementing Classes:
DurableTopicSubscription, SubscriptionImpl

public interface Subscription

A Subscription holds messages to be dispatched to a a Client Consumer

Version:
$Revision: 1.1.1.1 $

Method Summary
 void addMessage(MessageContainer container, ActiveMQMessage message)
          If the Subscription is a target for the message, the subscription will add a reference to the message and register an interest in the message to the container
 void clear()
          Called when the Subscription is discarded
 String getClientId()
           
 String getConsumerId()
           
 int getConsumerNumber()
           
 ActiveMQDestination getDestination()
           
 MessageIdentity getLastMessageIdentity()
          Retreives the messageIdentity of the last message sent to this Queue based Subscription
 ActiveMQMessage[] getMessagesToDispatch()
          Retrieve messages to dispatch
 String getPersistentKey()
          Returns the persistent key used to uniquely identify this durable topic subscription
 String getSelector()
           
 String getSubscriberName()
           
 SubscriberEntry getSubscriptionEntry()
          Lazily creates the persistent entry representation of this subscription
 boolean isActive()
           
 boolean isAtPrefetchLimit()
          Indicates the Subscription it's reached it's pre-fetch limit
 boolean isBrowser()
          Indicates the consumer is a browser only
 boolean isDurableTopic()
          Indicates the Consumer is a Durable Subscriber
 boolean isLocalSubscription()
           
 boolean isReadyToDispatch()
          Indicates if this Subscription has more messages to send to the Consumer
 boolean isSameDurableSubscription(ConsumerInfo info)
          Checks if this subscription is a duplicate durable subscription of the given consumer info
 boolean isTarget(ActiveMQMessage message)
          determines if the Subscription is interested in the message
 boolean isWildcard()
           
 void messageConsumed(MessageAck ack)
          Indicates a message has been delivered to a MessageConsumer which is typically called for topic based subscriptions
 void reset()
          Called when an active message consumer has closed.
 void setActive(boolean newActive)
          set the state of the Subscription
 void setActiveConsumer(BrokerClient client, ConsumerInfo info)
          Set the active consumer info
 void setLastMessageIdentifier(MessageIdentity messageIdentity)
          Used for a Queue based Subscription to set the last acknowledged message ID
 

Method Detail

setActiveConsumer

void setActiveConsumer(BrokerClient client,
                       ConsumerInfo info)
Set the active consumer info

Parameters:
client -
info -

clear

void clear()
           throws JMSException
Called when the Subscription is discarded

Throws:
JMSException

reset

void reset()
           throws JMSException
Called when an active message consumer has closed.

Throws:
JMSException

getClientId

String getClientId()
Returns:
Returns the clientId.

getSubscriberName

String getSubscriberName()
Returns:
Returns the subscriberName.

getDestination

ActiveMQDestination getDestination()
Returns:
Returns the destination.

getSelector

String getSelector()
Returns:
Returns the selector.

isActive

boolean isActive()
Returns:
Returns true if an active message consumer is associated with this

setActive

void setActive(boolean newActive)
               throws JMSException
set the state of the Subscription

Parameters:
newActive -
Throws:
JMSException

getConsumerNumber

int getConsumerNumber()
Returns:
Returns the consumerNumber.

getConsumerId

String getConsumerId()
Returns:
the consumer Id for the active consumer

isTarget

boolean isTarget(ActiveMQMessage message)
                 throws JMSException
determines if the Subscription is interested in the message

Parameters:
message -
Returns:
Throws:
JMSException

addMessage

void addMessage(MessageContainer container,
                ActiveMQMessage message)
                throws JMSException
If the Subscription is a target for the message, the subscription will add a reference to the message and register an interest in the message to the container

Parameters:
container -
message -
Throws:
JMSException

messageConsumed

void messageConsumed(MessageAck ack)
                     throws JMSException
Indicates a message has been delivered to a MessageConsumer which is typically called for topic based subscriptions

Parameters:
ack -
Throws:
JMSException

getMessagesToDispatch

ActiveMQMessage[] getMessagesToDispatch()
                                        throws JMSException
Retrieve messages to dispatch

Returns:
Throws:
JMSException

isReadyToDispatch

boolean isReadyToDispatch()
                          throws JMSException
Indicates if this Subscription has more messages to send to the Consumer

Returns:
true if more messages available to dispatch
Throws:
JMSException

isAtPrefetchLimit

boolean isAtPrefetchLimit()
                          throws JMSException
Indicates the Subscription it's reached it's pre-fetch limit

Returns:
true/false
Throws:
JMSException

isDurableTopic

boolean isDurableTopic()
                       throws JMSException
Indicates the Consumer is a Durable Subscriber

Returns:
Throws:
JMSException

isBrowser

boolean isBrowser()
                  throws JMSException
Indicates the consumer is a browser only

Returns:
true if a Browser
Throws:
JMSException

getLastMessageIdentity

MessageIdentity getLastMessageIdentity()
                                       throws JMSException
Retreives the messageIdentity of the last message sent to this Queue based Subscription

Returns:
the messageId of the last message or null
Throws:
JMSException

setLastMessageIdentifier

void setLastMessageIdentifier(MessageIdentity messageIdentity)
                              throws JMSException
Used for a Queue based Subscription to set the last acknowledged message ID

Parameters:
messageIdentity -
Throws:
JMSException

isWildcard

boolean isWildcard()

getPersistentKey

String getPersistentKey()
Returns the persistent key used to uniquely identify this durable topic subscription

Returns:

isSameDurableSubscription

boolean isSameDurableSubscription(ConsumerInfo info)
                                  throws JMSException
Checks if this subscription is a duplicate durable subscription of the given consumer info

Parameters:
info -
Returns:
true if this subscription is a durable topic subscription and the clientID and consumer names match
Throws:
JMSException

getSubscriptionEntry

SubscriberEntry getSubscriptionEntry()
Lazily creates the persistent entry representation of this subscription


isLocalSubscription

boolean isLocalSubscription()


Copyright © 2004-2010 Protique, Ltd.. All Rights Reserved.