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 */
017 package org.apache.activemq.broker.jmx;
018
019 import javax.management.ObjectName;
020 import org.apache.activemq.Service;
021
022 import java.util.Map;
023
024
025 /**
026 * @author David Martin Clavo david(dot)martin(dot)clavo(at)gmail.com (for the reloadLog4jProperties method)
027 *
028 */
029 public interface BrokerViewMBean extends Service {
030
031 /**
032 * @return The unique id of the broker.
033 */
034 @MBeanInfo("The unique id of the broker.")
035 String getBrokerId();
036
037 /**
038 * @return The name of the broker.
039 */
040 @MBeanInfo("The name of the broker.")
041 String getBrokerName();
042
043 /**
044 * @return The name of the broker.
045 */
046 @MBeanInfo("The version of the broker.")
047 String getBrokerVersion();
048
049 /**
050 * @return Uptime of the broker.
051 */
052 @MBeanInfo("Uptime of the broker.")
053 String getUptime();
054
055 /**
056 * The Broker will flush it's caches so that the garbage collector can
057 * reclaim more memory.
058 *
059 * @throws Exception
060 */
061 @MBeanInfo("Runs the Garbage Collector.")
062 void gc() throws Exception;
063
064 @MBeanInfo("Reset all broker statistics.")
065 void resetStatistics();
066
067 @MBeanInfo("Enable broker statistics.")
068 void enableStatistics();
069
070 @MBeanInfo("Disable broker statistics.")
071 void disableStatistics();
072
073 @MBeanInfo("Broker statistics enabled.")
074 boolean isStatisticsEnabled();
075
076 @MBeanInfo("Number of messages that have been sent to the broker.")
077 long getTotalEnqueueCount();
078
079 @MBeanInfo("Number of messages that have been acknowledged on the broker.")
080 long getTotalDequeueCount();
081
082 @MBeanInfo("Number of message consumers subscribed to destinations on the broker.")
083 long getTotalConsumerCount();
084
085 @MBeanInfo("Number of message producers active on destinations on the broker.")
086 long getTotalProducerCount();
087
088 @MBeanInfo("Number of unacknowledged messages on the broker.")
089 long getTotalMessageCount();
090
091 @MBeanInfo("Percent of memory limit used.")
092 int getMemoryPercentUsage();
093
094 @MBeanInfo("Memory limit, in bytes, used for holding undelivered messages before paging to temporary storage.")
095 long getMemoryLimit();
096
097 void setMemoryLimit(@MBeanInfo("bytes") long limit);
098
099 @MBeanInfo("Percent of store limit used.")
100 int getStorePercentUsage();
101
102 @MBeanInfo("Disk limit, in bytes, used for persistent messages before producers are blocked.")
103 long getStoreLimit();
104
105 void setStoreLimit(@MBeanInfo("bytes") long limit);
106
107 @MBeanInfo("Percent of temp limit used.")
108 int getTempPercentUsage();
109
110 @MBeanInfo("Disk limit, in bytes, used for non-persistent messages and temporary date before producers are blocked.")
111 long getTempLimit();
112
113 void setTempLimit(@MBeanInfo("bytes") long limit);
114
115 @MBeanInfo("Messages are synchronized to disk.")
116 boolean isPersistent();
117
118 @MBeanInfo("Slave broker.")
119 boolean isSlave();
120
121 /**
122 * Shuts down the JVM.
123 *
124 * @param exitCode the exit code that will be reported by the JVM process
125 * when it exits.
126 */
127 @MBeanInfo("Shuts down the JVM.")
128 void terminateJVM(@MBeanInfo("exitCode") int exitCode);
129
130 /**
131 * Stop the broker and all it's components.
132 */
133 @MBeanInfo("Stop the broker and all its components.")
134 void stop() throws Exception;
135 @MBeanInfo("Poll for queues matching queueName are empty before stopping")
136 void stopGracefully(String connectorName, String queueName, long timeout, long pollInterval) throws Exception;
137
138 @MBeanInfo("Topics (broadcasted 'queues'); generally system information.")
139 ObjectName[] getTopics();
140
141 @MBeanInfo("Standard Queues containing AIE messages.")
142 ObjectName[] getQueues();
143
144 @MBeanInfo("Temporary Topics; generally unused.")
145 ObjectName[] getTemporaryTopics();
146
147 @MBeanInfo("Temporary Queues; generally temporary message response holders.")
148 ObjectName[] getTemporaryQueues();
149
150 @MBeanInfo("Topic Subscribers")
151 ObjectName[] getTopicSubscribers();
152
153 @MBeanInfo("Durable (persistent) topic subscribers")
154 ObjectName[] getDurableTopicSubscribers();
155
156 @MBeanInfo("Inactive (disconnected persistent) topic subscribers")
157 ObjectName[] getInactiveDurableTopicSubscribers();
158
159 @MBeanInfo("Queue Subscribers.")
160 ObjectName[] getQueueSubscribers();
161
162 @MBeanInfo("Temporary Topic Subscribers.")
163 ObjectName[] getTemporaryTopicSubscribers();
164
165 @MBeanInfo("Temporary Queue Subscribers.")
166 ObjectName[] getTemporaryQueueSubscribers();
167
168 @MBeanInfo("Topic Producers.")
169 public ObjectName[] getTopicProducers();
170
171 @MBeanInfo("Queue Producers.")
172 public ObjectName[] getQueueProducers();
173
174 @MBeanInfo("Temporary Topic Producers.")
175 public ObjectName[] getTemporaryTopicProducers();
176
177 @MBeanInfo("Temporary Queue Producers.")
178 public ObjectName[] getTemporaryQueueProducers();
179
180 @MBeanInfo("Dynamic Destination Producers.")
181 public ObjectName[] getDynamicDestinationProducers();
182
183 @MBeanInfo("Adds a Connector to the broker.")
184 String addConnector(@MBeanInfo("discoveryAddress") String discoveryAddress) throws Exception;
185
186 @MBeanInfo("Adds a Network Connector to the broker.")
187 String addNetworkConnector(@MBeanInfo("discoveryAddress") String discoveryAddress) throws Exception;
188
189 @MBeanInfo("Removes a Connector from the broker.")
190 boolean removeConnector(@MBeanInfo("connectorName") String connectorName) throws Exception;
191
192 @MBeanInfo("Removes a Network Connector from the broker.")
193 boolean removeNetworkConnector(@MBeanInfo("connectorName") String connectorName) throws Exception;
194
195 /**
196 * Adds a Topic destination to the broker.
197 *
198 * @param name The name of the Topic
199 * @throws Exception
200 */
201 @MBeanInfo("Adds a Topic destination to the broker.")
202 void addTopic(@MBeanInfo("name") String name) throws Exception;
203
204 /**
205 * Adds a Queue destination to the broker.
206 *
207 * @param name The name of the Queue
208 * @throws Exception
209 */
210 @MBeanInfo("Adds a Queue destination to the broker.")
211 void addQueue(@MBeanInfo("name") String name) throws Exception;
212
213 /**
214 * Removes a Topic destination from the broker.
215 *
216 * @param name The name of the Topic
217 * @throws Exception
218 */
219 @MBeanInfo("Removes a Topic destination from the broker.")
220 void removeTopic(@MBeanInfo("name") String name) throws Exception;
221
222 /**
223 * Removes a Queue destination from the broker.
224 *
225 * @param name The name of the Queue
226 * @throws Exception
227 */
228 @MBeanInfo("Removes a Queue destination from the broker.")
229 void removeQueue(@MBeanInfo("name") String name) throws Exception;
230
231 /**
232 * Creates a new durable topic subscriber
233 *
234 * @param clientId the JMS client ID
235 * @param subscriberName the durable subscriber name
236 * @param topicName the name of the topic to subscribe to
237 * @param selector a selector or null
238 * @return the object name of the MBean registered in JMX
239 */
240 @MBeanInfo(value="Creates a new durable topic subscriber.")
241 ObjectName createDurableSubscriber(@MBeanInfo("clientId") String clientId, @MBeanInfo("subscriberName") String subscriberName, @MBeanInfo("topicName") String topicName, @MBeanInfo("selector") String selector) throws Exception;
242
243 /**
244 * Destroys a durable subscriber
245 *
246 * @param clientId the JMS client ID
247 * @param subscriberName the durable subscriber name
248 */
249 @MBeanInfo(value="Destroys a durable subscriber.")
250 void destroyDurableSubscriber(@MBeanInfo("clientId") String clientId, @MBeanInfo("subscriberName") String subscriberName) throws Exception;
251
252 /**
253 * Reloads log4j.properties from the classpath.
254 * This methods calls org.apache.activemq.transport.TransportLoggerControl.reloadLog4jProperties
255 * @throws Throwable
256 */
257 @MBeanInfo(value="Reloads log4j.properties from the classpath.")
258 public void reloadLog4jProperties() throws Throwable;
259
260 /**
261 * @deprecated use {@link #getTransportConnectors()} or {@link #getTransportConnectorByType(String)}
262 */
263 @Deprecated
264 @MBeanInfo("The url of the openwire connector - deprecated, use getTransportConnectors or getTransportConnectorByType instead")
265 String getOpenWireURL();
266
267 /**
268 * @deprecated use {@link #getTransportConnectors()} or {@link #getTransportConnectorByType(String)}
269 */
270 @Deprecated
271 @MBeanInfo("The url of the stomp connector - deprecated, use getTransportConnectors or getTransportConnectorByType instead")
272 String getStompURL();
273
274 /**
275 * @deprecated use {@link #getTransportConnectors()} or {@link #getTransportConnectorByType(String)}
276 */
277 @Deprecated
278 @MBeanInfo("The url of the SSL connector - deprecated, use getTransportConnectors or getTransportConnectorByType instead")
279 String getSslURL();
280
281 /**
282 * @deprecated use {@link #getTransportConnectors()} or {@link #getTransportConnectorByType(String)}
283 */
284 @Deprecated
285 @MBeanInfo("The url of the Stomp SSL connector - deprecated, use getTransportConnectors or getTransportConnectorByType instead")
286 String getStompSslURL();
287
288 @MBeanInfo("The url of the VM connector")
289 String getVMURL();
290
291 @MBeanInfo("The map of all defined transport connectors, with transport name as a key")
292 Map<String, String> getTransportConnectors();
293
294 @MBeanInfo("The url of transport connector by it's type; e.g. tcp, stomp, ssl, etc.")
295 String getTransportConnectorByType(String type);
296
297 @MBeanInfo("The location of the data directory")
298 public String getDataDirectory();
299
300 @MBeanInfo("JMSJobScheduler")
301 ObjectName getJMSJobScheduler();
302
303 }