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