org.activemq.store
Class ProxyTopicMessageStore

java.lang.Object
  extended by org.activemq.store.ProxyTopicMessageStore
All Implemented Interfaces:
Service, MessageStore, TopicMessageStore

public class ProxyTopicMessageStore
extends Object
implements TopicMessageStore

A simple proxy that delegates to another MessageStore.


Constructor Summary
ProxyTopicMessageStore(TopicMessageStore delegate)
           
 
Method Summary
 void addMessage(ActiveMQMessage message)
          Adds a message to the message store
 void decrementMessageCountAndMaybeDelete(MessageIdentity msgId)
          Decrement the reference count of this message ID and if there are no more references then delete the message from persistent store (or maybe archive it off somewhere)
 void deleteSubscription(String subscription)
           
 MessageStore getDelegate()
           
 MessageIdentity getLastestMessageIdentity()
          Returns the last message identity that was delivered on this container which can then be used as a checkpoint so that when new durable consumers start, we know where to checkpoint their subscriptions.
 ActiveMQMessage getMessage(MessageIdentity identity)
          Looks up a message using either the String messageID or the messageNumber.
 SubscriberEntry getSubscriberEntry(ConsumerInfo info)
          Finds the subscriber entry for the given consumer info
 void incrementMessageCount(MessageIdentity messageId)
          Increments the reference count of the message ID as its been dispatched to another subscriber.
 void recover(RecoveryListener listener)
          Recover any messages to be delivered.
 void recoverSubscription(String subscriptionId, MessageIdentity lastDispatchedMessage, RecoveryListener listener)
          For the new subcription find the last acknowledged message ID and then find any new messages since then and dispatch them to the subscription.
 void removeAllMessages()
          Removes all the messages from the message store.
 void removeMessage(MessageAck ack)
          Removes a message from the message store.
 void setLastAcknowledgedMessageIdentity(String subscription, MessageIdentity messageIdentity)
          Stores the last acknowledged messgeID for the given subscription so that we can recover and commence dispatching messages from the last checkpoint
 void setSubscriberEntry(ConsumerInfo info, SubscriberEntry subscriberEntry)
          Inserts or updates the subscriber info due to a subscription change
 void start()
          Called to start the service
 void stop()
          Called to shutdown the service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProxyTopicMessageStore

public ProxyTopicMessageStore(TopicMessageStore delegate)
Method Detail

getDelegate

public MessageStore getDelegate()

addMessage

public void addMessage(ActiveMQMessage message)
                throws JMSException
Description copied from interface: MessageStore
Adds a message to the message store

Specified by:
addMessage in interface MessageStore
Throws:
JMSException

getMessage

public ActiveMQMessage getMessage(MessageIdentity identity)
                           throws JMSException
Description copied from interface: MessageStore
Looks up a message using either the String messageID or the messageNumber. Implementations are encouraged to fill in the missing key if its easy to do so.

Specified by:
getMessage in interface MessageStore
Parameters:
identity - which contains either the messageID or the messageNumber
Returns:
the message or null if it does not exist
Throws:
JMSException

recover

public void recover(RecoveryListener listener)
             throws JMSException
Description copied from interface: MessageStore
Recover any messages to be delivered.

Specified by:
recover in interface MessageStore
Throws:
JMSException

removeAllMessages

public void removeAllMessages()
                       throws JMSException
Description copied from interface: MessageStore
Removes all the messages from the message store.

Specified by:
removeAllMessages in interface MessageStore
Throws:
JMSException

removeMessage

public void removeMessage(MessageAck ack)
                   throws JMSException
Description copied from interface: MessageStore
Removes a message from the message store.

Specified by:
removeMessage in interface MessageStore
Parameters:
ack - the ack request that cause the message to be removed. It conatins the identity which contains the messageID of the message that needs to be removed.
Throws:
JMSException

start

public void start()
           throws JMSException
Description copied from interface: Service
Called to start the service

Specified by:
start in interface Service
Throws:
JMSException

stop

public void stop()
          throws JMSException
Description copied from interface: Service
Called to shutdown the service

Specified by:
stop in interface Service
Throws:
JMSException

decrementMessageCountAndMaybeDelete

public void decrementMessageCountAndMaybeDelete(MessageIdentity msgId)
                                         throws JMSException
Description copied from interface: TopicMessageStore
Decrement the reference count of this message ID and if there are no more references then delete the message from persistent store (or maybe archive it off somewhere)

Specified by:
decrementMessageCountAndMaybeDelete in interface TopicMessageStore
Throws:
JMSException

getLastestMessageIdentity

public MessageIdentity getLastestMessageIdentity()
                                          throws JMSException
Description copied from interface: TopicMessageStore
Returns the last message identity that was delivered on this container which can then be used as a checkpoint so that when new durable consumers start, we know where to checkpoint their subscriptions.

Note that this method does not need to return a valid messageID, purely the sequence number.

Specified by:
getLastestMessageIdentity in interface TopicMessageStore
Returns:
the last message identity which was persisted in the durable store or null if the store is empty.
Throws:
JMSException

getSubscriberEntry

public SubscriberEntry getSubscriberEntry(ConsumerInfo info)
                                   throws JMSException
Description copied from interface: TopicMessageStore
Finds the subscriber entry for the given consumer info

Specified by:
getSubscriberEntry in interface TopicMessageStore
Returns:
Throws:
JMSException

incrementMessageCount

public void incrementMessageCount(MessageIdentity messageId)
                           throws JMSException
Description copied from interface: TopicMessageStore
Increments the reference count of the message ID as its been dispatched to another subscriber.

Specified by:
incrementMessageCount in interface TopicMessageStore
Throws:
JMSException

setLastAcknowledgedMessageIdentity

public void setLastAcknowledgedMessageIdentity(String subscription,
                                               MessageIdentity messageIdentity)
                                        throws JMSException
Description copied from interface: TopicMessageStore
Stores the last acknowledged messgeID for the given subscription so that we can recover and commence dispatching messages from the last checkpoint

Specified by:
setLastAcknowledgedMessageIdentity in interface TopicMessageStore
Throws:
JMSException

setSubscriberEntry

public void setSubscriberEntry(ConsumerInfo info,
                               SubscriberEntry subscriberEntry)
                        throws JMSException
Description copied from interface: TopicMessageStore
Inserts or updates the subscriber info due to a subscription change

Specified by:
setSubscriberEntry in interface TopicMessageStore
Throws:
JMSException

deleteSubscription

public void deleteSubscription(String subscription)
                        throws JMSException
Specified by:
deleteSubscription in interface TopicMessageStore
Throws:
JMSException

recoverSubscription

public void recoverSubscription(String subscriptionId,
                                MessageIdentity lastDispatchedMessage,
                                RecoveryListener listener)
                         throws JMSException
Description copied from interface: TopicMessageStore
For the new subcription find the last acknowledged message ID and then find any new messages since then and dispatch them to the subscription.

If this is a new subscription then the lastDispatchMessage should be written to the acknowledgement table to write a checkpoint so that when we recover we will start from the correct point.

e.g. if we dispatched some messages to a new durable topic subscriber, then went down before acknowledging any messages, we need to know the correct point from which to recover from.

Specified by:
recoverSubscription in interface TopicMessageStore
Throws:
JMSException


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