Subscription.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 package org.apache.qpid.server.subscription;
22 
23 import org.apache.qpid.AMQException;
24 import org.apache.qpid.framing.AMQShortString;
25 import org.apache.qpid.server.AMQChannel;
26 import org.apache.qpid.server.queue.AMQQueue;
27 import org.apache.qpid.server.queue.QueueEntry;
28 
29 public interface Subscription
30 {
31 
32 
33     public static enum State
34     {
35         ACTIVE,
36         SUSPENDED,
37         CLOSED
38     }
39 
40     public static interface StateListener
41     {
42         public void stateChange(Subscription sub, State oldState, State newState);
43     }
44 
45     AMQQueue getQueue();
46 
47     QueueEntry.SubscriptionAcquiredState getOwningState();
48 
49     void setQueue(AMQQueue queue);
50 
51     AMQChannel getChannel();
52 
53     AMQShortString getConsumerTag();
54 
55     boolean isSuspended();
56 
57     boolean hasInterest(QueueEntry msg);
58 
59     boolean isAutoClose();
60 
61     boolean isClosed();
62 
63     boolean isBrowser();
64 
65     void close();
66 
67     boolean filtersMessages();
68 
69     void send(QueueEntry msgthrows AMQException;
70 
71     void queueDeleted(AMQQueue queue)
72 
73 
74     boolean wouldSuspend(QueueEntry msg);
75 
76     void getSendLock();
77     void releaseSendLock();
78 
79     void resend(final QueueEntry entrythrows AMQException;
80 
81     void restoreCredit(final QueueEntry queueEntry);
82 
83     void setStateListener(final StateListener listener);
84 
85     public State getState();
86 
87     QueueEntry getLastSeenEntry();
88 
89     boolean setLastSeenEntry(QueueEntry expected, QueueEntry newValue);
90 
91 
92     boolean isActive();
93 
94 
95 
96 }