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    @MBeanInfo("ID of the Subscription.")
049    long getSubscriptionId();
050
051    /**
052     * @return the destination name
053     */
054    @MBeanInfo("The name of the destination the subscription is on.")
055    String getDestinationName();
056
057    /**
058     * @return the JMS selector on the current subscription
059     */
060    @MBeanInfo("The SQL-92 message header selector or XPATH body selector of the subscription.")
061    String getSelector();
062
063    /**
064     * Attempts to change the current active selector on the subscription. This
065     * operation is not supported for persistent topics.
066     */
067    void setSelector(@MBeanInfo("selector") String selector) throws InvalidSelectorException, UnsupportedOperationException;
068
069    /**
070     * @return true if the destination is a Queue
071     */
072    @MBeanInfo("Subscription is on a Queue")
073    boolean isDestinationQueue();
074
075    /**
076     * @return true of the destination is a Topic
077     */
078    @MBeanInfo("Subscription is on a Topic")
079    boolean isDestinationTopic();
080
081    /**
082     * @return true if the destination is temporary
083     */
084    @MBeanInfo("Subscription is on a temporary Queue/Topic")
085    boolean isDestinationTemporary();
086
087    /**
088     * @return true if the subscriber is active
089     */
090    @MBeanInfo("Subscription is active (connected and receiving messages).")
091    boolean isActive();
092
093    @MBeanInfo("Subscription was created by a demand-forwarding network bridge")
094    boolean isNetwork();
095
096    /**
097     * @return number of messages pending delivery
098     */
099    @MBeanInfo("Number of messages pending delivery.")
100    int getPendingQueueSize();
101
102    /**
103     * @return number of messages dispatched
104     */
105    @MBeanInfo("Number of messages dispatched awaiting acknowledgement.")
106    int getDispatchedQueueSize();
107
108    /**
109     * The same as the number of messages dispatched - making it explicit
110     * @return number of messages waiting for an acknowledge.
111     */
112    @MBeanInfo("Number of messages dispatched awaiting acknowledgement.")
113    int getMessageCountAwaitingAcknowledge();
114
115    /**
116     * @return number of messages that matched the subscription
117     */
118    @MBeanInfo("Number of messages that sent to the client.")
119    long getDispatchedCounter();
120
121    /**
122     * @return number of messages that matched the subscription
123     */
124    @MBeanInfo("Number of messages that matched the subscription.")
125    long getEnqueueCounter();
126
127    /**
128     * @return number of messages queued by the client
129     */
130    @MBeanInfo("Number of messages were sent to and acknowledge by the client.")
131    long getDequeueCounter();
132
133    /**
134     * @return the prefetch that has been configured for this subscriber
135     */
136    @MBeanInfo("Number of messages to pre-fetch and dispatch to the client.")
137    int getPrefetchSize();
138
139    /**
140     * @return whether or not the subscriber is retroactive or not
141     */
142    @MBeanInfo("The subscriber is retroactive (tries to receive broadcasted topic messages sent prior to connecting)")
143    boolean isRetroactive();
144
145    /**
146     * @return whether or not the subscriber is an exclusive consumer
147     */
148    @MBeanInfo("The subscriber is exclusive (no other subscribers may receive messages from the destination as long as this one is)")
149    boolean isExclusive();
150
151    /**
152     * @return whether or not the subscriber is durable (persistent)
153     */
154    @MBeanInfo("The subscription is persistent.")
155    boolean isDurable();
156
157    /**
158     * @return whether or not the subscriber ignores local messages
159     */
160    @MBeanInfo("The subscription ignores local messages.")
161    boolean isNoLocal();
162
163    /**
164     * @return if the Consumer is configured for Async dispatch
165     */
166    @MBeanInfo("Is the consumer configured for Async Dispatch")
167    boolean isDispatchAsync();
168
169    /**
170     * @return the maximum number of pending messages allowed in addition to the
171     *         prefetch size. If enabled to a non-zero value then this will
172     *         perform eviction of messages for slow consumers on non-durable
173     *         topics.
174     */
175    @MBeanInfo("The maximum number of pending messages allowed (in addition to the prefetch size).")
176    int getMaximumPendingMessageLimit();
177
178    /**
179     * @return the consumer priority
180     */
181    @MBeanInfo("The subscription priority")
182    byte getPriority();
183
184    /**
185     * @return the name of the consumer which is only used for durable
186     *         consumers.
187     */
188    @MBeanInfo("The name of the subscription (durable subscriptions only).")
189    String getSubscriptionName();
190
191    /**
192     * Returns true if this subscription (which may be using wildcards) matches the given queue name
193     *
194     * @param queueName the JMS queue name to match against
195     * @return true if this subscription matches the given queue or false if not
196     */
197    @MBeanInfo("Returns true if the subscription (which may be using wildcards) matches the given queue name")
198    boolean isMatchingQueue(String queueName);
199
200    /**
201     * Returns true if this subscription (which may be using wildcards) matches the given topic name
202     *
203     * @param topicName the JMS topic name to match against
204     * @return true if this subscription matches the given topic or false if not
205     */
206    @MBeanInfo("Returns true if the subscription (which may be using wildcards) matches the given topic name")
207    boolean isMatchingTopic(String topicName);
208
209    /**
210     * Returns true if the subscription is slow
211     *
212     * @return true if the subscription is slow
213     */
214    @MBeanInfo("Returns true if the subscription is slow")
215    boolean isSlowConsumer();
216
217    /**
218     * Returns the User Name used to authorize creation of this Subscription.
219     * This value can be null if display of user name information is disabled.
220     *
221     * @return the name of the user that created this Subscription
222     */
223    @MBeanInfo("User Name used to authorize creation of this Subscription")
224    String getUserName();
225
226    /**
227     * Returns the ObjectName of the Connection that created this Subscription.
228     * This value can be null if for instance this is an off-line durable subscription.
229     *
230     * @return the name of the Connection that created this Subscription.
231     */
232    @MBeanInfo("ObjectName of the Connection that created this Subscription")
233    ObjectName getConnection();
234
235    @MBeanInfo("Resets statistics.")
236    void resetStatistics();
237
238    @MBeanInfo("Messages consumed")
239    long getConsumedCount();
240
241}