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