|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.activemq.service.impl.SubscriptionImpl
A Subscription holds messages to be dispatched to a a Client Consumer
Field Summary | |
protected String |
brokerName
|
protected String |
clusterName
|
protected Dispatcher |
dispatch
|
(package private) Filter |
filter
|
(package private) QueueList |
messagePtrs
|
protected SynchronizedInt |
unconsumedMessagesDispatched
|
Constructor Summary | |
SubscriptionImpl(Dispatcher dispatcher,
BrokerClient client,
ConsumerInfo info,
Filter filter,
RedeliveryPolicy redeliveryPolicy)
Create a Subscription object that holds messages to be dispatched to a Consumer |
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 |
protected boolean |
clientIDsEqual(ActiveMQMessage message)
|
protected SubscriberEntry |
createSubscriptionEntry()
|
protected void |
doMessageConsume(MessageAck ack,
boolean remove)
Consume a message. |
protected static boolean |
equal(Object left,
Object right)
|
String |
getClientId()
|
String |
getConsumerId()
|
int |
getConsumerNumber()
|
ActiveMQDestination |
getDestination()
|
Filter |
getFilter()
|
MessageIdentity |
getLastMessageIdentity()
Retreives the messageIdentity of the last message sent to this Queue based Subscription |
ActiveMQMessage[] |
getMessagesToDispatch()
Retrieve messages to dispatch |
protected ActiveMQMessage[] |
getMessagesWithPrefetch()
|
String |
getPersistentKey()
Returns the persistent key used to uniquely identify this durable topic subscription |
RedeliveryPolicy |
getRedeliveryPolicy()
|
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 Subscriber is a Durable Subscriber |
boolean |
isNoLocal()
|
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 |
void |
onAcknowledgeTransactedMessageBeforeCommit(MessageAck ack)
We have not yet committed and so the message acknowledgement has not really occurred yet but we need to let the dispatcher know that we can commence dispatching more messages to the client. |
void |
redeliverMessage(MessageContainer container,
MessageAck ack)
Forces the given message to be redelivered |
void |
reset()
Called when an active subscriber has closed. |
void |
setActive(boolean active)
set the state of the Subscription |
void |
setActiveConsumer(BrokerClient client,
ConsumerInfo info)
Set the active consumer info |
void |
setClientId(String clientId)
|
void |
setFilter(Filter filter)
|
void |
setLastMessageIdentifier(MessageIdentity messageIdentity)
Used for a Queue based Subscription to set the last acknowledged message ID |
void |
setNoLocal(boolean noLocal)
|
void |
setRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy)
|
void |
setSubscriberName(String subscriberName)
|
String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Dispatcher dispatch
protected String brokerName
protected String clusterName
Filter filter
protected SynchronizedInt unconsumedMessagesDispatched
QueueList messagePtrs
Constructor Detail |
public SubscriptionImpl(Dispatcher dispatcher, BrokerClient client, ConsumerInfo info, Filter filter, RedeliveryPolicy redeliveryPolicy)
dispatcher
- client
- info
- filter
- Method Detail |
public void setActiveConsumer(BrokerClient client, ConsumerInfo info)
setActiveConsumer
in interface Subscription
client
- info
- public String toString()
public void clear() throws JMSException
clear
in interface Subscription
JMSException
public void reset() throws JMSException
reset
in interface Subscription
JMSException
public String getClientId()
getClientId
in interface Subscription
public void setClientId(String clientId)
clientId
- The clientId to set.public Filter getFilter()
public void setFilter(Filter filter)
filter
- The filter to set.public boolean isWildcard()
isWildcard
in interface Subscription
public String getPersistentKey()
Subscription
getPersistentKey
in interface Subscription
public boolean isSameDurableSubscription(ConsumerInfo info) throws JMSException
Subscription
isSameDurableSubscription
in interface Subscription
info
-
JMSException
public boolean isNoLocal()
public void setNoLocal(boolean noLocal)
noLocal
- The noLocal to set.public String getSubscriberName()
getSubscriberName
in interface Subscription
public void setSubscriberName(String subscriberName)
subscriberName
- The subscriberName to set.public RedeliveryPolicy getRedeliveryPolicy()
public void setRedeliveryPolicy(RedeliveryPolicy redeliveryPolicy)
public boolean isTarget(ActiveMQMessage message) throws JMSException
isTarget
in interface Subscription
message
-
JMSException
public void addMessage(MessageContainer container, ActiveMQMessage message) throws JMSException
addMessage
in interface Subscription
container
- message
-
JMSException
public void messageConsumed(MessageAck ack) throws JMSException
messageConsumed
in interface Subscription
ack
-
JMSException
public void onAcknowledgeTransactedMessageBeforeCommit(MessageAck ack) throws JMSException
Subscription
onAcknowledgeTransactedMessageBeforeCommit
in interface Subscription
ack
-
JMSException
public void redeliverMessage(MessageContainer container, MessageAck ack) throws JMSException
Subscription
redeliverMessage
in interface Subscription
container
- ack
-
JMSException
public ActiveMQMessage[] getMessagesToDispatch() throws JMSException
getMessagesToDispatch
in interface Subscription
JMSException
public SubscriberEntry getSubscriptionEntry()
Subscription
getSubscriptionEntry
in interface Subscription
protected SubscriberEntry createSubscriptionEntry()
protected ActiveMQMessage[] getMessagesWithPrefetch() throws JMSException
JMSException
public boolean isAtPrefetchLimit() throws JMSException
isAtPrefetchLimit
in interface Subscription
JMSException
public boolean isReadyToDispatch() throws JMSException
isReadyToDispatch
in interface Subscription
JMSException
public ActiveMQDestination getDestination()
getDestination
in interface Subscription
public String getSelector()
getSelector
in interface Subscription
public boolean isActive()
isActive
in interface Subscription
public void setActive(boolean active) throws JMSException
Subscription
setActive
in interface Subscription
active
- The active to set.
JMSException
public int getConsumerNumber()
getConsumerNumber
in interface Subscription
public String getConsumerId()
getConsumerId
in interface Subscription
public boolean isDurableTopic() throws JMSException
isDurableTopic
in interface Subscription
JMSException
public boolean isBrowser() throws JMSException
isBrowser
in interface Subscription
JMSException
public MessageIdentity getLastMessageIdentity() throws JMSException
Subscription
getLastMessageIdentity
in interface Subscription
JMSException
public void setLastMessageIdentifier(MessageIdentity messageIdentity) throws JMSException
Subscription
setLastMessageIdentifier
in interface Subscription
messageIdentity
-
JMSException
protected void doMessageConsume(MessageAck ack, boolean remove) throws JMSException
ack
- the ack commandremove
- whether we should actually remove the message (i.e. really consume the message) or should we just
update the counters for the dispatcher / prefetch logic to work
JMSException
protected boolean clientIDsEqual(ActiveMQMessage message)
protected static final boolean equal(Object left, Object right)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |