001/**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.activemq.broker.jmx;
018
019import javax.jms.InvalidSelectorException;
020import javax.management.ObjectName;
021
022/**
023 *
024 */
025public interface SubscriptionViewMBean {
026
027    /**
028     * @return the clientId of the Connection the Subscription is on
029     */
030    @MBeanInfo("JMS Client id of the Connection the Subscription is on.")
031    String getClientId();
032
033    /**
034     * @return the id of the Connection the Subscription is on
035     */
036    @MBeanInfo("ID of the Connection the Subscription is on.")
037    String getConnectionId();
038
039    /**
040     * @return the id of the Session the subscription is on
041     */
042    @MBeanInfo("ID of the Session the Subscription is on.")
043    long getSessionId();
044
045    /**
046     * @return the id of the Subscription
047     */
048    @Deprecated
049    @MBeanInfo("ID of the Subscription.")
050    long getSubcriptionId();
051
052    /**
053     * @return the id of the Subscription
054     */
055    @MBeanInfo("ID of the Subscription.")
056    long getSubscriptionId();
057
058    /**
059     * @return the destination name
060     */
061    @MBeanInfo("The name of the destination the subscription is on.")
062    String getDestinationName();
063
064    /**
065     * @return the JMS selector on the current subscription
066     */
067    @MBeanInfo("The SQL-92 message header selector or XPATH body selector of the subscription.")
068    String getSelector();
069
070    /**
071     * Attempts to change the current active selector on the subscription. This
072     * operation is not supported for persistent topics.
073     */
074    void setSelector(@MBeanInfo("selector") String selector) throws InvalidSelectorException, UnsupportedOperationException;
075
076    /**
077     * @return true if the destination is a Queue
078     */
079    @MBeanInfo("Subscription is on a Queue")
080    boolean isDestinationQueue();
081
082    /**
083     * @return true of the destination is a Topic
084     */
085    @MBeanInfo("Subscription is on a Topic")
086    boolean isDestinationTopic();
087
088    /**
089     * @return true if the destination is temporary
090     */
091    @MBeanInfo("Subscription is on a temporary Queue/Topic")
092    boolean isDestinationTemporary();
093
094    /**
095     * @return true if the subscriber is active
096     */
097    @MBeanInfo("Subscription is active (connected and receiving messages).")
098    boolean isActive();
099
100    @MBeanInfo("Subscription was created by a demand-forwarding network bridge")
101    boolean isNetwork();
102
103    /**
104     * @return number of messages pending delivery
105     */
106    @MBeanInfo("Number of messages pending delivery.")
107    int getPendingQueueSize();
108
109    /**
110     * @return number of messages dispatched
111     */
112    @MBeanInfo("Number of messages dispatched awaiting acknowledgement.")
113    int getDispatchedQueueSize();
114
115    /**
116     * The same as the number of messages dispatched -
117     * making it explicit
118     * @return
119     */
120    @MBeanInfo("Number of messages dispatched awaiting acknowledgement.")
121    int getMessageCountAwaitingAcknowledge();
122
123    /**
124     * @return number of messages that matched the subscription
125     */
126    @MBeanInfo("Number of messages that sent to the client.")
127    long getDispatchedCounter();
128
129    /**
130     * @return number of messages that matched the subscription
131     */
132    @MBeanInfo("Number of messages that matched the subscription.")
133    long getEnqueueCounter();
134
135    /**
136     * @return number of messages queued by the client
137     */
138    @MBeanInfo("Number of messages were sent to and acknowledge by the client.")
139    long getDequeueCounter();
140
141    /**
142     * @return the prefetch that has been configured for this subscriber
143     */
144    @MBeanInfo("Number of messages to pre-fetch and dispatch to the client.")
145    int getPrefetchSize();
146
147    /**
148     * @return whether or not the subscriber is retroactive or not
149     */
150    @MBeanInfo("The subscriber is retroactive (tries to receive broadcasted topic messages sent prior to connecting)")
151    boolean isRetroactive();
152
153    /**
154     * @return whether or not the subscriber is an exclusive consumer
155     */
156    @MBeanInfo("The subscriber is exclusive (no other subscribers may receive messages from the destination as long as this one is)")
157    boolean isExclusive();
158
159    /**
160     * @return whether or not the subscriber is durable (persistent)
161     */
162    @MBeanInfo("The subscription is persistent.")
163    boolean isDurable();
164
165    /**
166     * @return whether or not the subscriber ignores local messages
167     */
168    @MBeanInfo("The subscription ignores local messages.")
169    boolean isNoLocal();
170
171    /**
172     * @return if the Consumer is configured for Async dispatch
173     */
174    @MBeanInfo("Is the consumer configured for Async Dispatch")
175    boolean isDispatchAsync();
176
177    /**
178     * @return the maximum number of pending messages allowed in addition to the
179     *         prefetch size. If enabled to a non-zero value then this will
180     *         perform eviction of messages for slow consumers on non-durable
181     *         topics.
182     */
183    @MBeanInfo("The maximum number of pending messages allowed (in addition to the prefetch size).")
184    int getMaximumPendingMessageLimit();
185
186    /**
187     * @return the consumer priority
188     */
189    @MBeanInfo("The subscription priority")
190    byte getPriority();
191
192    /**
193     * @return the name of the consumer which is only used for durable
194     *         consumers.
195     */
196    @Deprecated
197    @MBeanInfo("The name of the subscription (durable subscriptions only).")
198    String getSubcriptionName();
199
200    /**
201     * @return the name of the consumer which is only used for durable
202     *         consumers.
203     */
204    @MBeanInfo("The name of the subscription (durable subscriptions only).")
205    String getSubscriptionName();
206
207    /**
208     * Returns true if this subscription (which may be using wildcards) matches the given queue name
209     *
210     * @param queueName the JMS queue name to match against
211     * @return true if this subscription matches the given queue or false if not
212     */
213    @MBeanInfo("Returns true if the subscription (which may be using wildcards) matches the given queue name")
214    boolean isMatchingQueue(String queueName);
215
216    /**
217     * Returns true if this subscription (which may be using wildcards) matches the given topic name
218     *
219     * @param topicName the JMS topic name to match against
220     * @return true if this subscription matches the given topic or false if not
221     */
222    @MBeanInfo("Returns true if the subscription (which may be using wildcards) matches the given topic name")
223    boolean isMatchingTopic(String topicName);
224
225    /**
226     * Returns true if the subscription is slow
227     *
228     * @return true if the subscription is slow
229     */
230    @MBeanInfo("Returns true if the subscription is slow")
231    boolean isSlowConsumer();
232
233    /**
234     * Returns the User Name used to authorize creation of this Subscription.
235     * This value can be null if display of user name information is disabled.
236     *
237     * @return the name of the user that created this Subscription
238     */
239    @MBeanInfo("User Name used to authorize creation of this Subscription")
240    String getUserName();
241
242    /**
243     * Returns the ObjectName of the Connection that created this Subscription.
244     * This value can be null if for instance this is an off-line durable subscription.
245     *
246     * @return the name of the Connection that created this Subscription.
247     */
248    @MBeanInfo("ObjectName of the Connection that created this Subscription")
249    ObjectName getConnection();
250
251
252    @MBeanInfo("Resets statistics.")
253    void resetStatistics();
254
255    @MBeanInfo("Messages consumed")
256    long getConsumedCount();
257
258}