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