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 023 /** 024 * @author David Martin Clavo david(dot)martin(dot)clavo(at)gmail.com (for the reloadLog4jProperties method) 025 * 026 */ 027 public 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 fush it's caches so that the garbage collector can 049 * recalaim 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 unacknowledged messages on the broker.") 078 long getTotalMessageCount(); 079 080 @MBeanInfo("Percent of memory limit used.") 081 int getMemoryPercentUsage(); 082 083 @MBeanInfo("Memory limit, in bytes, used for holding undelivered messages before paging to temporary storage.") 084 long getMemoryLimit(); 085 086 void setMemoryLimit(@MBeanInfo("bytes") long limit); 087 088 @MBeanInfo("Percent of store limit used.") 089 int getStorePercentUsage(); 090 091 @MBeanInfo("Disk limit, in bytes, used for persistent messages before producers are blocked.") 092 long getStoreLimit(); 093 094 void setStoreLimit(@MBeanInfo("bytes") long limit); 095 096 @MBeanInfo("Percent of temp limit used.") 097 int getTempPercentUsage(); 098 099 @MBeanInfo("Disk limit, in bytes, used for non-persistent messages and temporary date before producers are blocked.") 100 long getTempLimit(); 101 102 void setTempLimit(@MBeanInfo("bytes") long limit); 103 104 @MBeanInfo("Messages are synchronized to disk.") 105 boolean isPersistent(); 106 107 @MBeanInfo("Slave broker.") 108 boolean isSlave(); 109 110 /** 111 * Shuts down the JVM. 112 * 113 * @param exitCode the exit code that will be reported by the JVM process 114 * when it exits. 115 */ 116 @MBeanInfo("Shuts down the JVM.") 117 void terminateJVM(@MBeanInfo("exitCode") int exitCode); 118 119 /** 120 * Stop the broker and all it's components. 121 */ 122 @MBeanInfo("Stop the broker and all its components.") 123 void stop() throws Exception; 124 @MBeanInfo("Poll for queues matching queueName are empty before stopping") 125 void stopGracefully(String connectorName, String queueName, long timeout, long pollInterval) throws Exception; 126 127 @MBeanInfo("Topics (broadcasted 'queues'); generally system information.") 128 ObjectName[] getTopics(); 129 130 @MBeanInfo("Standard Queues containing AIE messages.") 131 ObjectName[] getQueues(); 132 133 @MBeanInfo("Temporary Topics; generally unused.") 134 ObjectName[] getTemporaryTopics(); 135 136 @MBeanInfo("Temporary Queues; generally temporary message response holders.") 137 ObjectName[] getTemporaryQueues(); 138 139 @MBeanInfo("Topic Subscribers") 140 ObjectName[] getTopicSubscribers(); 141 142 @MBeanInfo("Durable (persistent) topic subscribers") 143 ObjectName[] getDurableTopicSubscribers(); 144 145 @MBeanInfo("Inactive (disconnected persistent) topic subscribers") 146 ObjectName[] getInactiveDurableTopicSubscribers(); 147 148 @MBeanInfo("Queue Subscribers.") 149 ObjectName[] getQueueSubscribers(); 150 151 @MBeanInfo("Temporary Topic Subscribers.") 152 ObjectName[] getTemporaryTopicSubscribers(); 153 154 @MBeanInfo("Temporary Queue Subscribers.") 155 ObjectName[] getTemporaryQueueSubscribers(); 156 157 @MBeanInfo("Adds a Connector to the broker.") 158 String addConnector(@MBeanInfo("discoveryAddress") String discoveryAddress) throws Exception; 159 160 @MBeanInfo("Adds a Network Connector to the broker.") 161 String addNetworkConnector(@MBeanInfo("discoveryAddress") String discoveryAddress) throws Exception; 162 163 @MBeanInfo("Removes a Connector from the broker.") 164 boolean removeConnector(@MBeanInfo("connectorName") String connectorName) throws Exception; 165 166 @MBeanInfo("Removes a Network Connector from the broker.") 167 boolean removeNetworkConnector(@MBeanInfo("connectorName") String connectorName) throws Exception; 168 169 /** 170 * Adds a Topic destination to the broker. 171 * 172 * @param name The name of the Topic 173 * @throws Exception 174 */ 175 @MBeanInfo("Adds a Topic destination to the broker.") 176 void addTopic(@MBeanInfo("name") String name) throws Exception; 177 178 /** 179 * Adds a Queue destination to the broker. 180 * 181 * @param name The name of the Queue 182 * @throws Exception 183 */ 184 @MBeanInfo("Adds a Queue destination to the broker.") 185 void addQueue(@MBeanInfo("name") String name) throws Exception; 186 187 /** 188 * Removes a Topic destination from the broker. 189 * 190 * @param name The name of the Topic 191 * @throws Exception 192 */ 193 @MBeanInfo("Removes a Topic destination from the broker.") 194 void removeTopic(@MBeanInfo("name") String name) throws Exception; 195 196 /** 197 * Removes a Queue destination from the broker. 198 * 199 * @param name The name of the Queue 200 * @throws Exception 201 */ 202 @MBeanInfo("Removes a Queue destination from the broker.") 203 void removeQueue(@MBeanInfo("name") String name) throws Exception; 204 205 /** 206 * Creates a new durable topic subscriber 207 * 208 * @param clientId the JMS client ID 209 * @param subscriberName the durable subscriber name 210 * @param topicName the name of the topic to subscribe to 211 * @param selector a selector or null 212 * @return the object name of the MBean registered in JMX 213 */ 214 @MBeanInfo(value="Creates a new durable topic subscriber.") 215 ObjectName createDurableSubscriber(@MBeanInfo("clientId") String clientId, @MBeanInfo("subscriberName") String subscriberName, @MBeanInfo("topicName") String topicName, @MBeanInfo("selector") String selector) throws Exception; 216 217 /** 218 * Destroys a durable subscriber 219 * 220 * @param clientId the JMS client ID 221 * @param subscriberName the durable subscriber name 222 */ 223 @MBeanInfo(value="Destroys a durable subscriber.") 224 void destroyDurableSubscriber(@MBeanInfo("clientId") String clientId, @MBeanInfo("subscriberName") String subscriberName) throws Exception; 225 226 /** 227 * Reloads log4j.properties from the classpath. 228 * This methods calls org.apache.activemq.transport.TransportLoggerControl.reloadLog4jProperties 229 * @throws Throwable 230 */ 231 @MBeanInfo(value="Reloads log4j.properties from the classpath.") 232 public void reloadLog4jProperties() throws Throwable; 233 234 @MBeanInfo("The url of the openwire connector") 235 String getOpenWireURL(); 236 237 @MBeanInfo("The url of the stomp connector") 238 String getStompURL(); 239 240 @MBeanInfo("The url of the SSL connector") 241 String getSslURL(); 242 243 @MBeanInfo("The url of the Stomp SSL connector") 244 String getStompSslURL(); 245 246 @MBeanInfo("The url of the VM connector") 247 String getVMURL(); 248 249 @MBeanInfo("The location of the data directory") 250 public String getDataDirectory(); 251 252 @MBeanInfo("JMSJobScheduler") 253 ObjectName getJMSJobScheduler(); 254 255 }