KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > store > TopicMessageStore


1 /**
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
4  * file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
5  * to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
6  * License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
11  * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
12  * specific language governing permissions and limitations under the License.
13  */

14 package org.apache.activemq.store;
15
16 import java.io.IOException JavaDoc;
17 import javax.jms.JMSException JavaDoc;
18 import org.apache.activemq.broker.ConnectionContext;
19 import org.apache.activemq.command.Message;
20 import org.apache.activemq.command.MessageId;
21 import org.apache.activemq.command.SubscriptionInfo;
22 /**
23  * A MessageStore for durable topic subscriptions
24  *
25  * @version $Revision: 1.4 $
26  */

27 public interface TopicMessageStore extends MessageStore{
28     /**
29      * Stores the last acknowledged messgeID for the given subscription so that we can recover and commence dispatching
30      * messages from the last checkpoint
31      *
32      * @param context
33      * @param clientId
34      * @param subscriptionName
35      * @param messageId
36      * @param subscriptionPersistentId
37      * @throws IOException
38      */

39     public void acknowledge(ConnectionContext context,String JavaDoc clientId,String JavaDoc subscriptionName,MessageId messageId)
40                     throws IOException JavaDoc;
41
42     /**
43      * @param clientId
44      * @param subscriptionName
45      * @param sub
46      * @throws IOException
47      * @throws JMSException
48      */

49     public void deleteSubscription(String JavaDoc clientId,String JavaDoc subscriptionName) throws IOException JavaDoc;
50
51     /**
52      * For the new subscription find the last acknowledged message ID and then find any new messages since then and
53      * dispatch them to the subscription. <p/> e.g. if we dispatched some messages to a new durable topic subscriber,
54      * then went down before acknowledging any messages, we need to know the correct point from which to recover from.
55      *
56      * @param clientId
57      * @param subscriptionName
58      * @param listener
59      * @param subscription
60      *
61      * @throws Exception
62      */

63     public void recoverSubscription(String JavaDoc clientId,String JavaDoc subscriptionName,MessageRecoveryListener listener)
64                     throws Exception JavaDoc;
65
66     /**
67      * For an active subscription - retrieve messages from the store for the subscriber after the lastMessageId
68      * messageId <p/>
69      *
70      * @param clientId
71      * @param subscriptionName
72      * @param maxReturned
73      * @param listener
74      *
75      * @throws Exception
76      */

77     public void recoverNextMessages(String JavaDoc clientId,String JavaDoc subscriptionName,int maxReturned,
78                     MessageRecoveryListener listener) throws Exception JavaDoc;
79
80     /**
81      * A hint to the Store to reset any batching state for a durable subsriber
82      * @param clientId
83      * @param subscriptionName
84      *
85      */

86     public void resetBatching(String JavaDoc clientId,String JavaDoc subscriptionName);
87     
88     
89     /**
90      * Get the number of messages ready to deliver from the store to a durable subscriber
91      * @param clientId
92      * @param subscriberName
93      * @return the outstanding message count
94      * @throws IOException
95      */

96     public int getMessageCount(String JavaDoc clientId,String JavaDoc subscriberName) throws IOException JavaDoc;
97     
98     /**
99      * Finds the subscriber entry for the given consumer info
100      *
101      * @param clientId
102      * @param subscriptionName
103      * @return the SubscriptionInfo
104      * @throws IOException
105      */

106     public SubscriptionInfo lookupSubscription(String JavaDoc clientId,String JavaDoc subscriptionName) throws IOException JavaDoc;
107
108     /**
109      * Lists all the durable subscirptions for a given destination.
110      *
111      * @return an array SubscriptionInfos
112      * @throws IOException
113      */

114     public SubscriptionInfo[] getAllSubscriptions() throws IOException JavaDoc;
115
116     /**
117      * Inserts the subscriber info due to a subscription change <p/> If this is a new subscription and the retroactive
118      * is false, then the last message sent to the topic should be set as the last message acknowledged by they new
119      * subscription. Otherwise, if retroactive is true, then create the subscription without it having an acknowledged
120      * message so that on recovery, all message recorded for the topic get replayed.
121      *
122      * @param clientId
123      * @param subscriptionName
124      * @param selector
125      * @param retroactive
126      * @throws IOException
127      *
128      */

129     public void addSubsciption(String JavaDoc clientId,String JavaDoc subscriptionName,String JavaDoc selector,boolean retroactive)
130                     throws IOException JavaDoc;
131 }
132
Popular Tags