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    import java.util.Map;
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        @MBeanInfo("Percent of memory limit used.")
092        int getMemoryPercentUsage();
093    
094        @MBeanInfo("Memory limit, in bytes, used for holding undelivered messages before paging to temporary storage.")
095        long getMemoryLimit();
096    
097        void setMemoryLimit(@MBeanInfo("bytes") long limit);
098    
099        @MBeanInfo("Percent of store limit used.")
100        int getStorePercentUsage();
101    
102        @MBeanInfo("Disk limit, in bytes, used for persistent messages before producers are blocked.")
103        long getStoreLimit();
104    
105        void setStoreLimit(@MBeanInfo("bytes") long limit);
106    
107        @MBeanInfo("Percent of temp limit used.")
108        int getTempPercentUsage();
109    
110        @MBeanInfo("Disk limit, in bytes, used for non-persistent messages and temporary data before producers are blocked.")
111        long getTempLimit();
112    
113        void setTempLimit(@MBeanInfo("bytes") long limit);
114        
115        @MBeanInfo("Percent of job store limit used.")
116        int getJobSchedulerStorePercentUsage();
117    
118        @MBeanInfo("Disk limit, in bytes, used for scheduled messages before producers are blocked.")
119        long getJobSchedulerStoreLimit();
120    
121        void setJobSchedulerStoreLimit(@MBeanInfo("bytes") long limit);
122    
123        @MBeanInfo("Messages are synchronized to disk.")
124        boolean isPersistent();
125    
126        /**
127         * Shuts down the JVM.
128         *
129         * @param exitCode the exit code that will be reported by the JVM process
130         *                when it exits.
131         */
132        @MBeanInfo("Shuts down the JVM.")
133        void terminateJVM(@MBeanInfo("exitCode") int exitCode);
134    
135        /**
136         * Stop the broker and all it's components.
137         */
138        @MBeanInfo("Stop the broker and all its components.")
139        void stop() throws Exception;
140        @MBeanInfo("Poll for queues matching queueName are empty before stopping")
141        void stopGracefully(String connectorName, String queueName, long timeout, long pollInterval) throws Exception;
142    
143        @MBeanInfo("Topics (broadcasted 'queues'); generally system information.")
144        ObjectName[] getTopics();
145    
146        @MBeanInfo("Standard Queues containing AIE messages.")
147        ObjectName[] getQueues();
148    
149        @MBeanInfo("Temporary Topics; generally unused.")
150        ObjectName[] getTemporaryTopics();
151    
152        @MBeanInfo("Temporary Queues; generally temporary message response holders.")
153        ObjectName[] getTemporaryQueues();
154    
155        @MBeanInfo("Topic Subscribers")
156        ObjectName[] getTopicSubscribers();
157    
158        @MBeanInfo("Durable (persistent) topic subscribers")
159        ObjectName[] getDurableTopicSubscribers();
160    
161        @MBeanInfo("Inactive (disconnected persistent) topic subscribers")
162        ObjectName[] getInactiveDurableTopicSubscribers();
163    
164        @MBeanInfo("Queue Subscribers.")
165        ObjectName[] getQueueSubscribers();
166    
167        @MBeanInfo("Temporary Topic Subscribers.")
168        ObjectName[] getTemporaryTopicSubscribers();
169    
170        @MBeanInfo("Temporary Queue Subscribers.")
171        ObjectName[] getTemporaryQueueSubscribers();
172    
173        @MBeanInfo("Topic Producers.")
174        public ObjectName[] getTopicProducers();
175    
176        @MBeanInfo("Queue Producers.")
177        public ObjectName[] getQueueProducers();
178    
179        @MBeanInfo("Temporary Topic Producers.")
180        public ObjectName[] getTemporaryTopicProducers();
181    
182        @MBeanInfo("Temporary Queue Producers.")
183        public ObjectName[] getTemporaryQueueProducers();
184    
185        @MBeanInfo("Dynamic Destination Producers.")
186        public ObjectName[] getDynamicDestinationProducers();
187    
188        @MBeanInfo("Adds a Connector to the broker.")
189        String addConnector(@MBeanInfo("discoveryAddress") String discoveryAddress) throws Exception;
190    
191        @MBeanInfo("Adds a Network Connector to the broker.")
192        String addNetworkConnector(@MBeanInfo("discoveryAddress") String discoveryAddress) throws Exception;
193    
194        @MBeanInfo("Removes a Connector from the broker.")
195        boolean removeConnector(@MBeanInfo("connectorName") String connectorName) throws Exception;
196    
197        @MBeanInfo("Removes a Network Connector from the broker.")
198        boolean removeNetworkConnector(@MBeanInfo("connectorName") String connectorName) throws Exception;
199    
200        /**
201         * Adds a Topic destination to the broker.
202         *
203         * @param name The name of the Topic
204         * @throws Exception
205         */
206        @MBeanInfo("Adds a Topic destination to the broker.")
207        void addTopic(@MBeanInfo("name") String name) throws Exception;
208    
209        /**
210         * Adds a Queue destination to the broker.
211         *
212         * @param name The name of the Queue
213         * @throws Exception
214         */
215        @MBeanInfo("Adds a Queue destination to the broker.")
216        void addQueue(@MBeanInfo("name") String name) throws Exception;
217    
218        /**
219         * Removes a Topic destination from the broker.
220         *
221         * @param name The name of the Topic
222         * @throws Exception
223         */
224        @MBeanInfo("Removes a Topic destination from the broker.")
225        void removeTopic(@MBeanInfo("name") String name) throws Exception;
226    
227        /**
228         * Removes a Queue destination from the broker.
229         *
230         * @param name The name of the Queue
231         * @throws Exception
232         */
233        @MBeanInfo("Removes a Queue destination from the broker.")
234        void removeQueue(@MBeanInfo("name") String name) throws Exception;
235    
236        /**
237         * Creates a new durable topic subscriber
238         *
239         * @param clientId the JMS client ID
240         * @param subscriberName the durable subscriber name
241         * @param topicName the name of the topic to subscribe to
242         * @param selector a selector or null
243         * @return the object name of the MBean registered in JMX
244         */
245        @MBeanInfo(value="Creates a new durable topic subscriber.")
246        ObjectName createDurableSubscriber(@MBeanInfo("clientId") String clientId, @MBeanInfo("subscriberName") String subscriberName, @MBeanInfo("topicName") String topicName, @MBeanInfo("selector") String selector) throws Exception;
247    
248        /**
249         * Destroys a durable subscriber
250         *
251         * @param clientId the JMS client ID
252         * @param subscriberName the durable subscriber name
253         */
254        @MBeanInfo(value="Destroys a durable subscriber.")
255        void destroyDurableSubscriber(@MBeanInfo("clientId") String clientId, @MBeanInfo("subscriberName") String subscriberName) throws Exception;
256    
257        /**
258         * Reloads log4j.properties from the classpath.
259         * This methods calls org.apache.activemq.transport.TransportLoggerControl.reloadLog4jProperties
260         * @throws Throwable
261         */
262        @MBeanInfo(value="Reloads log4j.properties from the classpath.")
263        public void reloadLog4jProperties() throws Throwable;
264    
265        /**
266         * @deprecated use {@link #getTransportConnectors()} or {@link #getTransportConnectorByType(String)}
267         */
268        @Deprecated
269        @MBeanInfo("The url of the openwire connector - deprecated, use getTransportConnectors or getTransportConnectorByType instead")
270        String getOpenWireURL();
271    
272        /**
273         * @deprecated use {@link #getTransportConnectors()} or {@link #getTransportConnectorByType(String)}
274         */
275        @Deprecated
276        @MBeanInfo("The url of the stomp connector - deprecated, use getTransportConnectors or getTransportConnectorByType instead")
277        String getStompURL();
278    
279        /**
280         * @deprecated use {@link #getTransportConnectors()} or {@link #getTransportConnectorByType(String)}
281         */
282        @Deprecated
283        @MBeanInfo("The url of the SSL connector - deprecated, use getTransportConnectors or getTransportConnectorByType instead")
284        String getSslURL();
285    
286        /**
287         * @deprecated use {@link #getTransportConnectors()} or {@link #getTransportConnectorByType(String)}
288         */
289        @Deprecated
290        @MBeanInfo("The url of the Stomp SSL connector - deprecated, use getTransportConnectors or getTransportConnectorByType instead")
291        String getStompSslURL();
292    
293        @MBeanInfo("The url of the VM connector")
294        String getVMURL();
295    
296        @MBeanInfo("The map of all defined transport connectors, with transport name as a key")
297        Map<String, String> getTransportConnectors();
298    
299        @MBeanInfo("The url of transport connector by it's type; e.g. tcp, stomp, ssl, etc.")
300        String getTransportConnectorByType(String type);
301    
302        @MBeanInfo("The location of the data directory")
303        public String getDataDirectory();
304    
305        @MBeanInfo("JMSJobScheduler")
306        ObjectName getJMSJobScheduler();
307    
308    }