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