org.apache.activemq.store
Interface TopicMessageStore

All Superinterfaces:
MessageStore, Service
All Known Implementing Classes:
JDBCTopicMessageStore, JournalTopicMessageStore, KahaTopicMessageStore, MemoryTopicMessageStore, ProxyTopicMessageStore, QuickJournalTopicMessageStore, RapidTopicMessageStore

public interface TopicMessageStore
extends MessageStore

A MessageStore for durable topic subscriptions

Version:
$Revision: 1.4 $

Method Summary
 void acknowledge(ConnectionContext context, java.lang.String clientId, java.lang.String subscriptionName, MessageId messageId)
          Stores the last acknowledged messgeID for the given subscription so that we can recover and commence dispatching messages from the last checkpoint
 void addSubsciption(java.lang.String clientId, java.lang.String subscriptionName, java.lang.String selector, boolean retroactive)
          Inserts the subscriber info due to a subscription change

If this is a new subscription and the retroactive is false, then the last message sent to the topic should be set as the last message acknowledged by they new subscription.

 void deleteSubscription(java.lang.String clientId, java.lang.String subscriptionName)
           
 SubscriptionInfo[] getAllSubscriptions()
          Lists all the durable subscirptions for a given destination.
 int getMessageCount(java.lang.String clientId, java.lang.String subscriberName)
          Get the number of messages ready to deliver from the store to a durable subscriber
 MessageId getNextMessageIdToDeliver(java.lang.String clientId, java.lang.String subscriptionName, MessageId id)
          Get the next messageId to deliver to a subscriber after the MessageId provided
 MessageId getPreviousMessageIdToDeliver(java.lang.String clientId, java.lang.String subscriptionName, MessageId id)
          Get the previous messageId to deliver to a subscriber before the MessageId provided
 SubscriptionInfo lookupSubscription(java.lang.String clientId, java.lang.String subscriptionName)
          Finds the subscriber entry for the given consumer info
 void recoverNextMessages(java.lang.String clientId, java.lang.String subscriptionName, MessageId lastMessageId, int maxReturned, MessageRecoveryListener listener)
          For an active subscription - retrieve messages from the store for the subscriber after the lastMessageId messageId

 void recoverSubscription(java.lang.String clientId, java.lang.String subscriptionName, MessageRecoveryListener listener)
          For the new subscription find the last acknowledged message ID and then find any new messages since then and dispatch them to the subscription.
 void resetBatching(java.lang.String clientId, java.lang.String subscriptionName, MessageId nextToDispatch)
          A hint to the Store to reset any batching state for a durable subsriber
 
Methods inherited from interface org.apache.activemq.store.MessageStore
addMessage, addMessageReference, getDestination, getMessage, getMessageReference, recover, removeAllMessages, removeMessage, setUsageManager
 
Methods inherited from interface org.apache.activemq.Service
start, stop
 

Method Detail

acknowledge

void acknowledge(ConnectionContext context,
                 java.lang.String clientId,
                 java.lang.String subscriptionName,
                 MessageId messageId)
                 throws java.io.IOException
Stores the last acknowledged messgeID for the given subscription so that we can recover and commence dispatching messages from the last checkpoint

Parameters:
context -
clientId -
subscriptionName -
messageId -
subscriptionPersistentId -
Throws:
java.io.IOException

deleteSubscription

void deleteSubscription(java.lang.String clientId,
                        java.lang.String subscriptionName)
                        throws java.io.IOException
Parameters:
clientId -
subscriptionName -
sub -
Throws:
java.io.IOException
javax.jms.JMSException

recoverSubscription

void recoverSubscription(java.lang.String clientId,
                         java.lang.String subscriptionName,
                         MessageRecoveryListener listener)
                         throws java.lang.Exception
For the new subscription find the last acknowledged message ID and then find any new messages since then and dispatch them to the subscription.

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.

Parameters:
clientId -
subscriptionName -
listener -
subscription -
Throws:
java.lang.Exception

recoverNextMessages

void recoverNextMessages(java.lang.String clientId,
                         java.lang.String subscriptionName,
                         MessageId lastMessageId,
                         int maxReturned,
                         MessageRecoveryListener listener)
                         throws java.lang.Exception
For an active subscription - retrieve messages from the store for the subscriber after the lastMessageId messageId

Parameters:
clientId -
subscriptionName -
lastMessageId -
maxReturned -
listener -
Throws:
java.lang.Exception

resetBatching

void resetBatching(java.lang.String clientId,
                   java.lang.String subscriptionName,
                   MessageId nextToDispatch)
A hint to the Store to reset any batching state for a durable subsriber

Parameters:
clientId -
subscriptionName -
nextToDispatch -

getNextMessageIdToDeliver

MessageId getNextMessageIdToDeliver(java.lang.String clientId,
                                    java.lang.String subscriptionName,
                                    MessageId id)
                                    throws java.lang.Exception
Get the next messageId to deliver to a subscriber after the MessageId provided

Parameters:
clientId -
subscriptionName -
id -
Returns:
the next messageId or null
Throws:
java.io.IOException
java.lang.Exception

getPreviousMessageIdToDeliver

MessageId getPreviousMessageIdToDeliver(java.lang.String clientId,
                                        java.lang.String subscriptionName,
                                        MessageId id)
                                        throws java.lang.Exception
Get the previous messageId to deliver to a subscriber before the MessageId provided

Parameters:
clientId -
subscriptionName -
id -
Returns:
the next messageId or null
Throws:
java.io.IOException
java.lang.Exception

getMessageCount

int getMessageCount(java.lang.String clientId,
                    java.lang.String subscriberName)
                    throws java.io.IOException
Get the number of messages ready to deliver from the store to a durable subscriber

Parameters:
clientId -
subscriberName -
Returns:
the outstanding message count
Throws:
java.io.IOException

lookupSubscription

SubscriptionInfo lookupSubscription(java.lang.String clientId,
                                    java.lang.String subscriptionName)
                                    throws java.io.IOException
Finds the subscriber entry for the given consumer info

Parameters:
clientId -
subscriptionName -
Returns:
the SubscriptionInfo
Throws:
java.io.IOException

getAllSubscriptions

SubscriptionInfo[] getAllSubscriptions()
                                       throws java.io.IOException
Lists all the durable subscirptions for a given destination.

Returns:
an array SubscriptionInfos
Throws:
java.io.IOException

addSubsciption

void addSubsciption(java.lang.String clientId,
                    java.lang.String subscriptionName,
                    java.lang.String selector,
                    boolean retroactive)
                    throws java.io.IOException
Inserts the subscriber info due to a subscription change

If this is a new subscription and the retroactive is false, then the last message sent to the topic should be set as the last message acknowledged by they new subscription. Otherwise, if retroactive is true, then create the subscription without it having an acknowledged message so that on recovery, all message recorded for the topic get replayed.

Parameters:
clientId -
subscriptionName -
selector -
retroactive -
Throws:
java.io.IOException


Copyright © 2009 Apache Software Foundation. All Rights Reserved.