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; 020 021/** 022 * 023 */ 024public interface SubscriptionViewMBean { 025 026 /** 027 * @return the clientId of the Connection the Subscription is on 028 */ 029 @MBeanInfo("JMS Client id of the Connection the Subscription is on.") 030 String getClientId(); 031 032 /** 033 * @return the id of the Connection the Subscription is on 034 */ 035 @MBeanInfo("ID of the Connection the Subscription is on.") 036 String getConnectionId(); 037 038 /** 039 * @return the id of the Session the subscription is on 040 */ 041 @MBeanInfo("ID of the Session the Subscription is on.") 042 long getSessionId(); 043 044 /** 045 * @return the id of the Subscription 046 */ 047 @MBeanInfo("ID of the Subscription.") 048 long getSubcriptionId(); 049 050 /** 051 * @return the destination name 052 */ 053 @MBeanInfo("The name of the destionation the subscription is on.") 054 String getDestinationName(); 055 056 /** 057 * @return the JMS selector on the current subscription 058 */ 059 @MBeanInfo("The SQL-92 message header selector or XPATH body selector of the subscription.") 060 String getSelector(); 061 062 /** 063 * Attempts to change the current active selector on the subscription. This 064 * operation is not supported for persistent topics. 065 */ 066 void setSelector(@MBeanInfo("selector") String selector) throws InvalidSelectorException, UnsupportedOperationException; 067 068 /** 069 * @return true if the destination is a Queue 070 */ 071 @MBeanInfo("Subscription is on a Queue") 072 boolean isDestinationQueue(); 073 074 /** 075 * @return true of the destination is a Topic 076 */ 077 @MBeanInfo("Subscription is on a Topic") 078 boolean isDestinationTopic(); 079 080 /** 081 * @return true if the destination is temporary 082 */ 083 @MBeanInfo("Subscription is on a temporary Queue/Topic") 084 boolean isDestinationTemporary(); 085 086 /** 087 * @return true if the subscriber is active 088 */ 089 @MBeanInfo("Subscription is active (connected and receiving messages).") 090 boolean isActive(); 091 092 /** 093 * @return number of messages pending delivery 094 */ 095 @MBeanInfo("Number of messages pending delivery.") 096 int getPendingQueueSize(); 097 098 /** 099 * @return number of messages dispatched 100 */ 101 @MBeanInfo("Number of messages dispatched awaiting acknowledgement.") 102 int getDispatchedQueueSize(); 103 104 /** 105 * The same as the number of messages dispatched - 106 * making it explicit 107 * @return 108 */ 109 @MBeanInfo("Number of messages dispatched awaiting acknowledgement.") 110 int getMessageCountAwaitingAcknowledge(); 111 112 /** 113 * @return number of messages that matched the subscription 114 */ 115 @MBeanInfo("Number of messages that sent to the client.") 116 long getDispatchedCounter(); 117 118 /** 119 * @return number of messages that matched the subscription 120 */ 121 @MBeanInfo("Number of messages that matched the subscription.") 122 long getEnqueueCounter(); 123 124 /** 125 * @return number of messages queued by the client 126 */ 127 @MBeanInfo("Number of messages were sent to and acknowledge by the client.") 128 long getDequeueCounter(); 129 130 /** 131 * @return the prefetch that has been configured for this subscriber 132 */ 133 @MBeanInfo("Number of messages to pre-fetch and dispatch to the client.") 134 int getPrefetchSize(); 135 136 /** 137 * @return whether or not the subscriber is retroactive or not 138 */ 139 @MBeanInfo("The subscriber is retroactive (tries to receive broadcasted topic messages sent prior to connecting)") 140 boolean isRetroactive(); 141 142 /** 143 * @return whether or not the subscriber is an exclusive consumer 144 */ 145 @MBeanInfo("The subscriber is exclusive (no other subscribers may receive messages from the destination as long as this one is)") 146 boolean isExclusive(); 147 148 /** 149 * @return whether or not the subscriber is durable (persistent) 150 */ 151 @MBeanInfo("The subsription is persistent.") 152 boolean isDurable(); 153 154 /** 155 * @return whether or not the subscriber ignores local messages 156 */ 157 @MBeanInfo("The subsription ignores local messages.") 158 boolean isNoLocal(); 159 160 /** 161 * @return the maximum number of pending messages allowed in addition to the 162 * prefetch size. If enabled to a non-zero value then this will 163 * perform eviction of messages for slow consumers on non-durable 164 * topics. 165 */ 166 @MBeanInfo("The maximum number of pending messages allowed (in addition to the prefetch size).") 167 int getMaximumPendingMessageLimit(); 168 169 /** 170 * @return the consumer priority 171 */ 172 @MBeanInfo("The subscription priority") 173 byte getPriority(); 174 175 /** 176 * @return the name of the consumer which is only used for durable 177 * consumers. 178 */ 179 @MBeanInfo("The name of the subscription (durable subscriptions only).") 180 String getSubcriptionName(); 181 182 /** 183 * Returns true if this subscription (which may be using wildcards) matches the given queue name 184 * 185 * @param queueName the JMS queue name to match against 186 * @return true if this subscription matches the given queue or false if not 187 */ 188 @MBeanInfo("Returns true if the subscription (which may be using wildcards) matches the given queue name") 189 boolean isMatchingQueue(String queueName); 190 191 /** 192 * Returns true if this subscription (which may be using wildcards) matches the given topic name 193 * 194 * @param topicName the JMS topic name to match against 195 * @return true if this subscription matches the given topic or false if not 196 */ 197 @MBeanInfo("Returns true if the subscription (which may be using wildcards) matches the given topic name") 198 boolean isMatchingTopic(String topicName); 199}