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