KickJava   Java API By Example, From Geeks To Geeks.

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


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

18 package org.apache.activemq.store;
19
20 import java.io.IOException JavaDoc;
21
22 import javax.jms.JMSException JavaDoc;
23
24 import org.apache.activemq.broker.ConnectionContext;
25 import org.apache.activemq.command.MessageId;
26 import org.apache.activemq.command.SubscriptionInfo;
27
28 /**
29  * A MessageStore for durable topic subscriptions
30  *
31  * @version $Revision: 1.4 $
32  */

33 public interface TopicReferenceStore extends ReferenceStore, TopicMessageStore {
34     /**
35      * Stores the last acknowledged messgeID for the given subscription so that we can recover and commence dispatching
36      * messages from the last checkpoint
37      *
38      * @param context
39      * @param clientId
40      * @param subscriptionName
41      * @param messageId
42      * @param subscriptionPersistentId
43      * @throws IOException
44      */

45     public void acknowledge(ConnectionContext context,String JavaDoc clientId,String JavaDoc subscriptionName,MessageId messageId)
46                     throws IOException JavaDoc;
47
48     /**
49      * @param clientId
50      * @param subscriptionName
51      * @param sub
52      * @throws IOException
53      * @throws JMSException
54      */

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

69     public void recoverSubscription(String JavaDoc clientId,String JavaDoc subscriptionName,MessageRecoveryListener listener)
70                     throws Exception JavaDoc;
71
72     /**
73      * For an active subscription - retrieve messages from the store for the subscriber after the lastMessageId
74      * messageId <p/>
75      *
76      * @param clientId
77      * @param subscriptionName
78      * @param maxReturned
79      * @param listener
80      *
81      * @throws Exception
82      */

83     public void recoverNextMessages(String JavaDoc clientId,String JavaDoc subscriptionName,int maxReturned,
84                     MessageRecoveryListener listener) throws Exception JavaDoc;
85
86     /**
87      * A hint to the Store to reset any batching state for a durable subsriber
88      * @param clientId
89      * @param subscriptionName
90      *
91      */

92     public void resetBatching(String JavaDoc clientId,String JavaDoc subscriptionName);
93     
94     
95     /**
96      * Get the number of messages ready to deliver from the store to a durable subscriber
97      * @param clientId
98      * @param subscriberName
99      * @return the outstanding message count
100      * @throws IOException
101      */

102     public int getMessageCount(String JavaDoc clientId,String JavaDoc subscriberName) throws IOException JavaDoc;
103     
104     /**
105      * Finds the subscriber entry for the given consumer info
106      *
107      * @param clientId
108      * @param subscriptionName
109      * @return the SubscriptionInfo
110      * @throws IOException
111      */

112     public SubscriptionInfo lookupSubscription(String JavaDoc clientId,String JavaDoc subscriptionName) throws IOException JavaDoc;
113
114     /**
115      * Lists all the durable subscirptions for a given destination.
116      *
117      * @return an array SubscriptionInfos
118      * @throws IOException
119      */

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

135     public void addSubsciption(String JavaDoc clientId,String JavaDoc subscriptionName,String JavaDoc selector,boolean retroactive)
136                     throws IOException JavaDoc;
137 }
138
Popular Tags