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