This closes #464

This commit is contained in:
Clebert Suconic 2016-04-18 17:50:09 -04:00
commit b4d6ae0f2c
25 changed files with 315 additions and 21 deletions

View File

@ -26,16 +26,19 @@ public interface AcceptorControl extends ActiveMQComponentControl {
/**
* Returns the name of the acceptor
*/
@Attribute(desc = "name of the acceptor")
String getName();
/**
* Returns the class name of the AcceptorFactory implementation
* used by this acceptor.
*/
@Attribute(desc = "class name of the AcceptorFactory implementation used by this acceptor")
String getFactoryClassName();
/**
* Returns the parameters used to configure this acceptor
*/
@Attribute(desc = "parameters used to configure this acceptor")
Map<String, Object> getParameters();
}

View File

@ -24,6 +24,7 @@ public interface ActiveMQComponentControl {
/**
* Returns {@code true} if this component is started, {@code false} else.
*/
@Attribute(desc = "whether this component is started")
boolean isStarted();
/**

View File

@ -26,16 +26,19 @@ public interface ActiveMQServerControl {
/**
* Returns this server's version.
*/
@Attribute(desc = "server's version")
String getVersion();
/**
* Returns the number of connections connected to this server.
* Returns the number of clients connected to this server.
*/
@Attribute(desc = "number of clients connected to this server")
int getConnectionCount();
/**
* Return whether this server is started.
*/
@Attribute(desc = "whether this server is started")
boolean isStarted();
/**
@ -43,6 +46,7 @@ public interface ActiveMQServerControl {
*
* @see org.apache.activemq.artemis.api.core.Interceptor
*/
@Attribute(desc = "list of interceptors used by this server for incoming messages")
String[] getIncomingInterceptorClassNames();
/**
@ -50,126 +54,151 @@ public interface ActiveMQServerControl {
*
* @see org.apache.activemq.artemis.api.core.Interceptor
*/
@Attribute(desc = "list of interceptors used by this server for outgoing messages")
String[] getOutgoingInterceptorClassNames();
/**
* Returns whether this server is clustered.
*/
@Attribute(desc = "whether this server is clustered")
boolean isClustered();
/**
* Returns the maximum number of threads in the <em>scheduled</em> thread pool.
*/
@Attribute(desc = "maximum number of threads in the scheduled thread pool")
int getScheduledThreadPoolMaxSize();
/**
* Returns the maximum number of threads in the thread pool.
*/
@Attribute(desc = "maximum number of threads in the thread pool")
int getThreadPoolMaxSize();
/**
* Returns the interval time (in milliseconds) to invalidate security credentials.
*/
@Attribute(desc = "interval time (in milliseconds) to invalidate security credentials")
long getSecurityInvalidationInterval();
/**
* Returns whether security is enabled for this server.
*/
@Attribute(desc = "whether security is enabled for this server")
boolean isSecurityEnabled();
/**
* Returns the file system directory used to store bindings.
*/
@Attribute(desc = "file system directory used to store bindings")
String getBindingsDirectory();
/**
* Returns the file system directory used to store journal log.
*/
@Attribute(desc = "file system directory used to store journal log")
String getJournalDirectory();
/**
* Returns the type of journal used by this server (either {@code NIO} or {@code ASYNCIO}).
*/
@Attribute(desc = "type of journal used by this server")
String getJournalType();
/**
* Returns whether the journal is synchronized when receiving transactional data.
*/
@Attribute(desc = "whether the journal is synchronized when receiving transactional data")
boolean isJournalSyncTransactional();
/**
* Returns whether the journal is synchronized when receiving non-transactional data.
*/
@Attribute(desc = "whether the journal is synchronized when receiving non-transactional datar")
boolean isJournalSyncNonTransactional();
/**
* Returns the size (in bytes) of each journal files.
*/
@Attribute(desc = "size (in bytes) of each journal files")
int getJournalFileSize();
/**
* Returns the number of journal files to pre-create.
*/
@Attribute(desc = "number of journal files to pre-create")
int getJournalMinFiles();
/**
* Returns the maximum number of write requests that can be in the AIO queue at any given time.
*/
@Attribute(desc = "maximum number of write requests that can be in the AIO queue at any given time")
int getJournalMaxIO();
/**
* Returns the size of the internal buffer on the journal.
*/
@Attribute(desc = "size of the internal buffer on the journal")
int getJournalBufferSize();
/**
* Returns the timeout (in nanoseconds) used to flush internal buffers on the journal.
*/
@Attribute(desc = "timeout (in nanoseconds) used to flush internal buffers on the journal")
int getJournalBufferTimeout();
/**
* do any clients failover on a server shutdown
*/
@Attribute(desc = "if clients failover on a server shutdown")
void setFailoverOnServerShutdown(boolean failoverOnServerShutdown) throws Exception;
/**
* returns if clients failover on a server shutdown
*/
@Attribute(desc = "if clients failover on a server shutdown")
boolean isFailoverOnServerShutdown();
/**
* Returns the minimal number of journal files before compacting.
*/
@Attribute(desc = "minimal number of journal files before compacting")
int getJournalCompactMinFiles();
/**
* Return the percentage of live data before compacting the journal.
*/
@Attribute(desc = "percentage of live data before compacting the journal")
int getJournalCompactPercentage();
/**
* Returns whether this server is using persistence and store data.
*/
@Attribute(desc = "whether this server is using persistence and store data")
boolean isPersistenceEnabled();
/**
* Returns whether the bindings directory is created on this server startup.
*/
@Attribute(desc = "whether the bindings directory is created on this server startu")
boolean isCreateBindingsDir();
/**
* Returns whether the journal directory is created on this server startup.
*/
@Attribute(desc = "whether the journal directory is created on this server startup")
boolean isCreateJournalDir();
/**
* Returns whether message counter is enabled for this server.
*/
@Attribute(desc = "whether message counter is enabled for this server")
boolean isMessageCounterEnabled();
/**
* Returns the maximum number of days kept in memory for message counter.
*/
@Attribute(desc = "maximum number of days kept in memory for message counter")
int getMessageCounterMaxDayCount();
/**
@ -177,11 +206,13 @@ public interface ActiveMQServerControl {
*
* @param count value must be greater than 0
*/
@Attribute(desc = "maximum number of days kept in memory for message counter")
void setMessageCounterMaxDayCount(int count) throws Exception;
/**
* Returns the sample period (in milliseconds) to take message counter snapshot.
*/
@Attribute(desc = "sample period (in milliseconds) to take message counter snapshot")
long getMessageCounterSamplePeriod();
/**
@ -189,6 +220,7 @@ public interface ActiveMQServerControl {
*
* @param newPeriod value must be greater than 1000ms
*/
@Attribute(desc = "sample period to take message counter snapshot")
void setMessageCounterSamplePeriod(long newPeriod) throws Exception;
/**
@ -196,21 +228,25 @@ public interface ActiveMQServerControl {
* <br>
* If a backup server has been activated, returns {@code false}.
*/
@Attribute(desc = "whether this server is a backup")
boolean isBackup();
/**
* Returns whether this server shares its data store with a corresponding live or backup server.
*/
@Attribute(desc = "whether this server shares its data store with a corresponding live or backup serve")
boolean isSharedStore();
/**
* Returns the file system directory used to store paging files.
*/
@Attribute(desc = "file system directory used to store paging files")
String getPagingDirectory();
/**
* Returns whether delivery count is persisted before messages are delivered to the consumers.
*/
@Attribute(desc = "whether delivery count is persisted before messages are delivered to the consumers")
boolean isPersistDeliveryCountBeforeDelivery();
/**
@ -218,6 +254,7 @@ public interface ActiveMQServerControl {
* <br>
* This value overrides the connection time to live <em>sent by the client</em>.
*/
@Attribute(desc = "connection time to live")
long getConnectionTTLOverride();
/**
@ -225,6 +262,7 @@ public interface ActiveMQServerControl {
* <br>
* Clients can send management messages to this address to manage this server.
*/
@Attribute(desc = "management address of this server")
String getManagementAddress();
/**
@ -232,74 +270,88 @@ public interface ActiveMQServerControl {
* <br>
* Clients can bind queues to this address to receive management notifications emitted by this server.
*/
@Attribute(desc = "management notification address of this server")
String getManagementNotificationAddress();
/**
* Returns the size of the cache for pre-creating message IDs.
*/
@Attribute(desc = "size of the cache for pre-creating message IDs")
int getIDCacheSize();
/**
* Returns whether message ID cache is persisted.
*/
@Attribute(desc = "whether message ID cache is persisted")
boolean isPersistIDCache();
/**
* Returns the file system directory used to store large messages.
*/
@Attribute(desc = "file system directory used to store large messages")
String getLargeMessagesDirectory();
/**
* Returns whether wildcard routing is supported by this server.
*/
@Attribute(desc = "whether wildcard routing is supported by this server")
boolean isWildcardRoutingEnabled();
/**
* Returns the timeout (in milliseconds) after which transactions is removed
* from the resource manager after it was created.
*/
@Attribute(desc = "timeout (in milliseconds) after which transactions is removed from the resource manager after it was created")
long getTransactionTimeout();
/**
* Returns the frequency (in milliseconds) to scan transactions to detect which transactions
* have timed out.
*/
@Attribute(desc = "frequency (in milliseconds) to scan transactions to detect which transactions have timed out")
long getTransactionTimeoutScanPeriod();
/**
* Returns the frequency (in milliseconds) to scan messages to detect which messages
* have expired.
*/
@Attribute(desc = "frequency (in milliseconds) to scan messages to detect which messages have expired")
long getMessageExpiryScanPeriod();
/**
* Returns the priority of the thread used to scan message expiration.
*/
@Attribute(desc = "priority of the thread used to scan message expiration")
long getMessageExpiryThreadPriority();
/**
* Returns whether code coming from connection is executed asynchronously or not.
*/
@Attribute(desc = "whether code coming from connection is executed asynchronously or not")
boolean isAsyncConnectionExecutionEnabled();
/**
* Returns the connectors configured for this server.
*/
@Attribute(desc = "connectors configured for this server")
Object[] getConnectors() throws Exception;
/**
* Returns the connectors configured for this server using JSON serialization.
*/
@Attribute(desc = "connectors configured for this server using JSON serialization")
String getConnectorsAsJSON() throws Exception;
/**
* Returns the addresses created on this server.
*/
@Attribute(desc = "addresses created on this server")
String[] getAddressNames();
/**
* Returns the names of the queues created on this server.
*/
@Attribute(desc = "names of the queues created on this server")
String[] getQueueNames();
// Operations ----------------------------------------------------
@ -435,11 +487,13 @@ public interface ActiveMQServerControl {
/**
* List transactions which have been heuristically committed.
*/
@Operation(desc = "List transactions which have been heuristically committed")
String[] listHeuristicCommittedTransactions() throws Exception;
/**
* List transactions which have been heuristically rolled back.
*/
@Operation(desc = "List transactions which have been heuristically rolled back")
String[] listHeuristicRolledBackTransactions() throws Exception;
/**
@ -563,6 +617,7 @@ public interface ActiveMQServerControl {
@Operation(desc = "returns the address settings as a JSON string for an address match", impact = MBeanOperationInfo.INFO)
String getAddressSettingsAsJSON(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch) throws Exception;
@Attribute(desc = "names of the diverts deployed on this server")
String[] getDivertNames();
@Operation(desc = "Create a Divert", impact = MBeanOperationInfo.ACTION)
@ -577,6 +632,7 @@ public interface ActiveMQServerControl {
@Operation(desc = "Destroy a Divert", impact = MBeanOperationInfo.ACTION)
void destroyDivert(@Parameter(name = "name", desc = "Name of the divert") String name) throws Exception;
@Attribute(desc = "names of the bridges deployed on this server")
String[] getBridgeNames();
@Operation(desc = "Create a Bridge", impact = MBeanOperationInfo.ACTION)

View File

@ -26,19 +26,22 @@ public interface AddressControl {
/**
* Returns the managed address.
*/
@Attribute(desc = "managed address")
String getAddress();
/**
* Returns the roles (name and permissions) associated to this address.
* Returns the roles (name and permissions) associated with this address.
*/
@Attribute(desc = "roles (name and permissions) associated with this address")
Object[] getRoles() throws Exception;
/**
* Returns the roles (name and permissions) associated to this address
* Returns the roles (name and permissions) associated with this address
* using JSON serialization.
* <br>
* Java objects can be recreated from JSON serialization using {@link RoleInfo#from(String)}.
*/
@Attribute(desc = "roles (name and permissions) associated with this address using JSON serialization")
String getRolesAsJSON() throws Exception;
@Operation(desc = "returns the number of estimated bytes being used by the queue, used to control paging and blocking",
@ -52,11 +55,13 @@ public interface AddressControl {
/**
* Returns the names of the queues bound to this address.
*/
@Attribute(desc = "names of the queues bound to this address")
String[] getQueueNames() throws Exception;
/**
* Returns the number of pages used by this address.
*/
@Attribute(desc = "number of pages used by this address")
int getNumberOfPages() throws Exception;
/**
@ -64,15 +69,18 @@ public interface AddressControl {
*
* @throws Exception
*/
@Attribute(desc = "whether this address is paging")
boolean isPaging() throws Exception;
/**
* Returns the number of bytes used by each page for this address.
*/
@Attribute(desc = "number of bytes used by each page for this address")
long getNumberOfBytesPerPage() throws Exception;
/**
* Returns the names of all bindings (both queues and diverts) bound to this address
*/
@Attribute(desc = "names of all bindings (both queues and diverts) bound to this address")
String[] getBindingNames() throws Exception;
}

View File

@ -0,0 +1,34 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.artemis.api.core.management;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Info for a MBean Attribute.
* <p>
* This annotation is used only for attributes which can be seen
* through a GUI.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Attribute {
String desc() default "";
}

View File

@ -24,60 +24,72 @@ public interface BridgeControl extends ActiveMQComponentControl {
/**
* Returns the name of this bridge
*/
@Attribute(desc = "name of this bridge")
String getName();
/**
* Returns the name of the queue this bridge is consuming messages from.
*/
@Attribute(desc = "name of the queue this bridge is consuming messages from")
String getQueueName();
/**
* Returns the address this bridge will forward messages to.
*/
@Attribute(desc = "address this bridge will forward messages to")
String getForwardingAddress();
/**
* Returns the filter string associated to this bridge.
* Returns the filter string associated with this bridge.
*/
@Attribute(desc = "filter string associated with this bridge")
String getFilterString();
/**
* Return the name of the org.apache.activemq.artemis.core.server.cluster.Transformer implementation associated to this bridge.
* Return the name of the org.apache.activemq.artemis.core.server.cluster.Transformer implementation associated with this bridge.
*/
@Attribute(desc = "name of the org.apache.activemq.artemis.core.server.cluster.Transformer implementation associated with this bridge")
String getTransformerClassName();
/**
* Returns any list of static connectors used by this bridge
*/
@Attribute(desc = "list of static connectors used by this bridge")
String[] getStaticConnectors() throws Exception;
/**
* Returns the name of the discovery group used by this bridge.
*/
@Attribute(desc = "name of the discovery group used by this bridge")
String getDiscoveryGroupName();
/**
* Returns the retry interval used by this bridge.
*/
@Attribute(desc = "retry interval used by this bridge")
long getRetryInterval();
/**
* Returns the retry interval multiplier used by this bridge.
*/
@Attribute(desc = "retry interval multiplier used by this bridge")
double getRetryIntervalMultiplier();
/**
* Returns the number of reconnection attempts used by this bridge.
*/
@Attribute(desc = "number of reconnection attempts used by this bridge")
int getReconnectAttempts();
/**
* Returns whether this bridge is using duplicate detection.
*/
@Attribute(desc = "whether this bridge is using duplicate detection")
boolean isUseDuplicateDetection();
/**
* Returns whether this bridge is using high availability
*/
@Attribute(desc = "whether this bridge is using high availability")
boolean isHA();
}

View File

@ -24,36 +24,43 @@ public interface BroadcastGroupControl extends ActiveMQComponentControl {
/**
* Returns the configuration name of this broadcast group.
*/
@Attribute(desc = "name of this broadcast group")
String getName();
/**
* Returns the local port this broadcast group is bound to.
*/
@Attribute(desc = "local port this broadcast group is bound to")
int getLocalBindPort() throws Exception;
/**
* Returns the address this broadcast group is broadcasting to.
*/
@Attribute(desc = "address this broadcast group is broadcasting to")
String getGroupAddress() throws Exception;
/**
* Returns the port this broadcast group is broadcasting to.
*/
@Attribute(desc = "port this broadcast group is broadcasting to")
int getGroupPort() throws Exception;
/**
* Returns the period used by this broadcast group.
*/
@Attribute(desc = "period used by this broadcast group")
long getBroadcastPeriod();
/**
* Returns the pairs of live-backup connectors that are broadcasted by this broadcast group.
*/
@Attribute(desc = "pairs of live-backup connectors that are broadcasted by this broadcast group")
Object[] getConnectorPairs();
/**
* Returns the pairs of live-backup connectors that are broadcasted by this broadcast group
* using JSON serialization.
*/
@Attribute(desc = "pairs of live-backup connectors that are broadcasted by this broadcast group using JSON serialization")
String getConnectorPairsAsJSON() throws Exception;
}

View File

@ -26,56 +26,67 @@ public interface ClusterConnectionControl extends ActiveMQComponentControl {
/**
* Returns the configuration name of this cluster connection.
*/
@Attribute(desc = "name of this cluster connection")
String getName();
/**
* Returns the address used by this cluster connection.
*/
@Attribute(desc = "address used by this cluster connection")
String getAddress();
/**
* Returns the node ID used by this cluster connection.
*/
@Attribute(desc = "node ID used by this cluster connection")
String getNodeID();
/**
* Return whether this cluster connection use duplicate detection.
*/
@Attribute(desc = "whether this cluster connection use duplicate detection")
boolean isDuplicateDetection();
/**
* Return whether this cluster connection forward messages when it has no local consumers.
* Return the type of message load balancing strategy this bridge will use.
*/
@Attribute(desc = "type of message load balancing strategy this bridge will use")
String getMessageLoadBalancingType();
/**
* Return the Topology that this Cluster Connection knows about
*/
@Attribute(desc = "Topology that this Cluster Connection knows about")
String getTopology();
/**
* Returns the maximum number of hops used by this cluster connection.
*/
@Attribute(desc = "maximum number of hops used by this cluster connection")
int getMaxHops();
/**
* Returns the list of static connectors
*/
@Attribute(desc = "list of static connectors")
Object[] getStaticConnectors();
/**
* Returns the list of static connectors as JSON
*/
@Attribute(desc = "list of static connectors as JSON")
String getStaticConnectorsAsJSON() throws Exception;
/**
* Returns the name of the discovery group used by this cluster connection.
*/
@Attribute(desc = "name of the discovery group used by this cluster connection")
String getDiscoveryGroupName();
/**
* Returns the connection retry interval used by this cluster connection.
*/
@Attribute(desc = "connection retry interval used by this cluster connection")
long getRetryInterval();
/**
@ -83,5 +94,6 @@ public interface ClusterConnectionControl extends ActiveMQComponentControl {
* <br>
* keys are node IDs, values are the addresses used to connect to the nodes.
*/
@Attribute(desc = "map of the nodes connected to this cluster connection (keys are node IDs, values are the addresses used to connect to the nodes)")
Map<String, String> getNodes() throws Exception;
}

View File

@ -24,6 +24,7 @@ public interface DivertControl {
/**
* Returns the filter used by this divert.
*/
@Attribute(desc = "filter used by this divert")
String getFilter();
/**
@ -32,30 +33,36 @@ public interface DivertControl {
* if {@code true} messages will be exclusively diverted and will not be routed to the origin address,
* else messages will be routed both to the origin address and the forwarding address.
*/
@Attribute(desc = "whether this divert is exclusive")
boolean isExclusive();
/**
* Returns the cluster-wide unique name of this divert.
*/
@Attribute(desc = "cluster-wide unique name of this divert")
String getUniqueName();
/**
* Returns the routing name of this divert.
*/
@Attribute(desc = "routing name of this divert")
String getRoutingName();
/**
* Returns the origin address used by this divert.
*/
@Attribute(desc = "origin address used by this divert")
String getAddress();
/**
* Returns the forwarding address used by this divert.
*/
@Attribute(desc = "forwarding address used by this divert")
String getForwardingAddress();
/**
* Return the name of the org.apache.activemq.artemis.core.server.cluster.Transformer implementation associated to this bridge.
* Return the name of the org.apache.activemq.artemis.core.server.cluster.Transformer implementation associated with this divert.
*/
@Attribute(desc = "name of the org.apache.activemq.artemis.core.server.cluster.Transformer implementation associated with this divert")
String getTransformerClassName();
}

View File

@ -29,86 +29,103 @@ public interface QueueControl {
/**
* Returns the name of this queue.
*/
@Attribute(desc = "name of this queue")
String getName();
/**
* Returns the address this queue is bound to.
*/
@Attribute(desc = "address this queue is bound to")
String getAddress();
/**
* Returns this queue ID.
*/
@Attribute(desc = "ID of this queue")
long getID();
/**
* Returns whether this queue is temporary.
*/
@Attribute(desc = "whether this queue is temporary")
boolean isTemporary();
/**
* Returns whether this queue is durable.
*/
@Attribute(desc = "whether this queue is durable")
boolean isDurable();
/**
* Returns the filter associated to this queue.
* Returns the filter associated with this queue.
*/
@Attribute(desc = "filter associated with this queue")
String getFilter();
/**
* Returns the number of messages currently in this queue.
*/
@Attribute(desc = "number of messages currently in this queue (includes scheduled, paged, and in-delivery messages)")
long getMessageCount();
/**
* Returns the number of scheduled messages in this queue.
*/
@Attribute(desc = "number of scheduled messages in this queue")
long getScheduledCount();
/**
* Returns the number of consumers consuming messages from this queue.
*/
@Attribute(desc = "number of consumers consuming messages from this queue")
int getConsumerCount();
/**
* Returns the number of messages that this queue is currently delivering to its consumers.
*/
@Attribute(desc = "number of messages that this queue is currently delivering to its consumers")
int getDeliveringCount();
/**
* Returns the number of messages added to this queue since it was created.
*/
@Attribute(desc = "number of messages added to this queue since it was created")
long getMessagesAdded();
/**
* Returns the number of messages added to this queue since it was created.
*/
@Attribute(desc = "number of messages acknowledged from this queue since it was created")
long getMessagesAcknowledged();
/**
* Returns the first message on the queue as JSON
*/
@Attribute(desc = "first message on the queue as JSON")
String getFirstMessageAsJSON() throws Exception;
/**
* Returns the timestamp of the first message in milliseconds.
*/
@Attribute(desc = "timestamp of the first message in milliseconds")
Long getFirstMessageTimestamp() throws Exception;
/**
* Returns the age of the first message in milliseconds.
*/
@Attribute(desc = "age of the first message in milliseconds")
Long getFirstMessageAge() throws Exception;
/**
* Returns the expiry address associated to this queue.
* Returns the expiry address associated with this queue.
*/
@Attribute(desc = "expiry address associated with this queue")
String getExpiryAddress();
/**
* Returns the dead-letter address associated to this queue.
* Returns the dead-letter address associated with this queue.
*/
@Attribute(desc = "dead-letter address associated with this queue")
String getDeadLetterAddress();
// Operations ----------------------------------------------------
@ -396,7 +413,7 @@ public interface QueueControl {
/**
* Returns whether the queue is paused.
*/
@Operation(desc = "Inspects if the queue is paused", impact = MBeanOperationInfo.INFO)
@Attribute(desc = "whether the queue is paused")
boolean isPaused() throws Exception;
/**

View File

@ -21,6 +21,7 @@ import java.util.Map;
import javax.management.MBeanOperationInfo;
import javax.management.openmbean.CompositeData;
import org.apache.activemq.artemis.api.core.management.Attribute;
import org.apache.activemq.artemis.api.core.management.Operation;
import org.apache.activemq.artemis.api.core.management.Parameter;
@ -31,43 +32,51 @@ public interface JMSQueueControl extends DestinationControl {
// Attributes ----------------------------------------------------
/**
* Returns the expiry address associated to this queue.
* Returns the expiry address associated with this queue.
*/
@Attribute(desc = "expiry address associated with this queue")
String getExpiryAddress();
/**
* Returns the dead-letter address associated to this queue.
* Returns the dead-letter address associated with this queue.
*/
@Attribute(desc = "dead-letter address associated with this queue")
String getDeadLetterAddress();
/**
* Returns the number of scheduled messages in this queue.
*/
@Attribute(desc = "number of scheduled messages in this queue")
long getScheduledCount();
/**
* Returns the number of consumers consuming messages from this queue.
*/
@Attribute(desc = "number of consumers consuming messages from this queue")
int getConsumerCount();
/**
* returns the selector for the queue
*/
@Attribute(desc = "selector for the queue")
String getSelector();
/**
* Returns the first message on the queue as JSON
*/
@Attribute(desc = "first message on the queue as JSON")
String getFirstMessageAsJSON() throws Exception;
/**
* Returns the timestamp of the first message in milliseconds.
*/
@Attribute(desc = "timestamp of the first message in milliseconds")
Long getFirstMessageTimestamp() throws Exception;
/**
* Returns the age of the first message in milliseconds.
*/
@Attribute(desc = "age of the first message in milliseconds")
Long getFirstMessageAge() throws Exception;
// Operations ----------------------------------------------------

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.api.jms.management;
import javax.management.MBeanOperationInfo;
import org.apache.activemq.artemis.api.core.management.Attribute;
import org.apache.activemq.artemis.api.core.management.Operation;
import org.apache.activemq.artemis.api.core.management.Parameter;
@ -30,31 +31,37 @@ public interface JMSServerControl {
/**
* Returns whether this server is started.
*/
@Attribute(desc = "whether this server is started")
boolean isStarted();
/**
* Returns this server's version
*/
@Attribute(desc = "server's version")
String getVersion();
/**
* Returns the names of the JMS topics available on this server.
*/
@Attribute(desc = "names of the JMS topics available on this server")
String[] getTopicNames();
/**
* Returns the names of the JMS queues available on this server.
*/
@Attribute(desc = "names of the JMS queues available on this server")
String[] getQueueNames();
/**
* Returns the names of the JMS connection factories available on this server.
*/
@Attribute(desc = "names of the JMS connection factories available on this server")
String[] getConnectionFactoryNames();
/**
* Returns the servers nodeId
* Returns the server's nodeId
*/
@Attribute(desc = "server's nodeId")
String getNodeID();
// Operations ----------------------------------------------------
@ -311,7 +318,7 @@ public interface JMSServerControl {
*
* @see JMSConsumerInfo#from(String)
*/
@Operation(desc = "List all JMS consumers associated to a JMS Connection")
@Operation(desc = "List all JMS consumers associated with a JMS Connection")
String listConsumersAsJSON(@Parameter(desc = "a connection ID", name = "connectionID") String connectionID) throws Exception;
/**
@ -320,7 +327,7 @@ public interface JMSServerControl {
*
* @see JMSConsumerInfo#from(String)
*/
@Operation(desc = "List all JMS consumers associated to a JMS Connection")
@Operation(desc = "List all JMS consumers associated with a JMS Connection")
String listAllConsumersAsJSON() throws Exception;
/**

View File

@ -20,6 +20,7 @@ import java.util.Map;
import javax.management.MBeanOperationInfo;
import org.apache.activemq.artemis.api.core.management.Attribute;
import org.apache.activemq.artemis.api.core.management.Operation;
import org.apache.activemq.artemis.api.core.management.Parameter;
@ -31,26 +32,31 @@ public interface TopicControl extends DestinationControl {
/**
* Returns the number of (durable and non-durable) subscribers for this topic.
*/
@Attribute(desc = "number of (durable and non-durable) subscribers for this topic")
int getSubscriptionCount();
/**
* Returns the number of <em>durable</em> subscribers for this topic.
*/
@Attribute(desc = "number of durable subscribers for this topic")
int getDurableSubscriptionCount();
/**
* Returns the number of <em>non-durable</em> subscribers for this topic.
*/
@Attribute(desc = "number of non-durable subscribers for this topic")
int getNonDurableSubscriptionCount();
/**
* Returns the number of messages for all <em>durable</em> subscribers for this topic.
*/
@Attribute(desc = "number of messages for all durable subscribers for this topic")
int getDurableMessageCount();
/**
* Returns the number of messages for all <em>non-durable</em> subscribers for this topic.
*/
@Attribute(desc = "number of messages for all non-durable subscribers for this topic")
int getNonDurableMessageCount();
/**

View File

@ -505,7 +505,7 @@ public class JMSQueueControlImpl extends StandardMBean implements JMSQueueContro
@Override
public MBeanInfo getMBeanInfo() {
MBeanInfo info = super.getMBeanInfo();
return new MBeanInfo(info.getClassName(), info.getDescription(), info.getAttributes(), info.getConstructors(), MBeanInfoHelper.getMBeanOperationsInfo(JMSQueueControl.class), info.getNotifications());
return new MBeanInfo(info.getClassName(), info.getDescription(), MBeanInfoHelper.getMBeanAttributesInfo(JMSQueueControl.class), info.getConstructors(), MBeanInfoHelper.getMBeanOperationsInfo(JMSQueueControl.class), info.getNotifications());
}
// Package protected ---------------------------------------------

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.jms.management.impl;
import javax.jms.JMSRuntimeException;
import javax.management.ListenerNotFoundException;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanOperationInfo;
import javax.management.Notification;
@ -743,6 +744,11 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo
return MBeanInfoHelper.getMBeanOperationsInfo(JMSServerControl.class);
}
@Override
protected MBeanAttributeInfo[] fillMBeanAttributeInfo() {
return MBeanInfoHelper.getMBeanAttributesInfo(JMSServerControl.class);
}
// Private -------------------------------------------------------
private void checkStarted() {

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.core.management.impl;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanInfo;
import javax.management.MBeanOperationInfo;
import javax.management.NotCompliantMBeanException;
@ -69,10 +70,12 @@ public abstract class AbstractControl extends StandardMBean {
protected abstract MBeanOperationInfo[] fillMBeanOperationInfo();
protected abstract MBeanAttributeInfo[] fillMBeanAttributeInfo();
@Override
public MBeanInfo getMBeanInfo() {
MBeanInfo info = super.getMBeanInfo();
return new MBeanInfo(info.getClassName(), info.getDescription(), info.getAttributes(), info.getConstructors(), fillMBeanOperationInfo(), info.getNotifications());
return new MBeanInfo(info.getClassName(), info.getDescription(), fillMBeanAttributeInfo(), info.getConstructors(), fillMBeanOperationInfo(), info.getNotifications());
}
// Private -------------------------------------------------------

View File

@ -18,6 +18,7 @@ package org.apache.activemq.artemis.core.management.impl;
import java.util.Map;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
@ -120,6 +121,11 @@ public class AcceptorControlImpl extends AbstractControl implements AcceptorCont
return MBeanInfoHelper.getMBeanOperationsInfo(AcceptorControl.class);
}
@Override
protected MBeanAttributeInfo[] fillMBeanAttributeInfo() {
return MBeanInfoHelper.getMBeanAttributesInfo(AcceptorControl.class);
}
// Public --------------------------------------------------------
// Package protected ---------------------------------------------

View File

@ -31,6 +31,7 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import javax.management.ListenerNotFoundException;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanNotificationInfo;
import javax.management.MBeanOperationInfo;
import javax.management.Notification;
@ -1842,6 +1843,11 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active
return MBeanInfoHelper.getMBeanOperationsInfo(ActiveMQServerControl.class);
}
@Override
protected MBeanAttributeInfo[] fillMBeanAttributeInfo() {
return MBeanInfoHelper.getMBeanAttributesInfo(ActiveMQServerControl.class);
}
private void checkStarted() {
if (!server.isStarted()) {
throw new IllegalStateException("Broker is not started. It can not be managed yet");

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.core.management.impl;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import java.util.ArrayList;
import java.util.List;
@ -229,6 +230,11 @@ public class AddressControlImpl extends AbstractControl implements AddressContro
return MBeanInfoHelper.getMBeanOperationsInfo(AddressControl.class);
}
@Override
protected MBeanAttributeInfo[] fillMBeanAttributeInfo() {
return MBeanInfoHelper.getMBeanAttributesInfo(AddressControl.class);
}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.core.management.impl;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import org.apache.activemq.artemis.api.core.management.BridgeControl;
@ -221,6 +222,11 @@ public class BridgeControlImpl extends AbstractControl implements BridgeControl
return MBeanInfoHelper.getMBeanOperationsInfo(BridgeControl.class);
}
@Override
protected MBeanAttributeInfo[] fillMBeanAttributeInfo() {
return MBeanInfoHelper.getMBeanAttributesInfo(BridgeControl.class);
}
// Public --------------------------------------------------------
// Package protected ---------------------------------------------

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.core.management.impl;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration;
@ -188,6 +189,11 @@ public class BroadcastGroupControlImpl extends AbstractControl implements Broadc
return MBeanInfoHelper.getMBeanOperationsInfo(BroadcastGroupControl.class);
}
@Override
protected MBeanAttributeInfo[] fillMBeanAttributeInfo() {
return MBeanInfoHelper.getMBeanAttributesInfo(BroadcastGroupControl.class);
}
// Public --------------------------------------------------------
// Package protected ---------------------------------------------

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.core.management.impl;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import java.util.List;
import java.util.Map;
@ -244,6 +245,11 @@ public class ClusterConnectionControlImpl extends AbstractControl implements Clu
return MBeanInfoHelper.getMBeanOperationsInfo(ClusterConnectionControl.class);
}
@Override
protected MBeanAttributeInfo[] fillMBeanAttributeInfo() {
return MBeanInfoHelper.getMBeanAttributesInfo(ClusterConnectionControl.class);
}
// Public --------------------------------------------------------
// Package protected ---------------------------------------------

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.core.management.impl;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import org.apache.activemq.artemis.api.core.management.DivertControl;
@ -129,6 +130,11 @@ public class DivertControlImpl extends AbstractControl implements DivertControl
return MBeanInfoHelper.getMBeanOperationsInfo(DivertControl.class);
}
@Override
protected MBeanAttributeInfo[] fillMBeanAttributeInfo() {
return MBeanInfoHelper.getMBeanAttributesInfo(DivertControl.class);
}
// Public --------------------------------------------------------
// Package protected ---------------------------------------------

View File

@ -16,14 +16,15 @@
*/
package org.apache.activemq.artemis.core.management.impl;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;
import org.apache.activemq.artemis.api.core.management.Attribute;
import org.apache.activemq.artemis.api.core.management.Operation;
import org.apache.activemq.artemis.api.core.management.Parameter;
@ -51,6 +52,40 @@ public class MBeanInfoHelper {
return operations.toArray(new MBeanOperationInfo[operations.size()]);
}
public static MBeanAttributeInfo[] getMBeanAttributesInfo(final Class mbeanInterface) {
List<MBeanAttributeInfo> tempAttributes = new ArrayList<>();
List<MBeanAttributeInfo> finalAttributes = new ArrayList<>();
List<String> alreadyAdded = new ArrayList<>();
for (Method method : mbeanInterface.getMethods()) {
if (MBeanInfoHelper.isGetterMethod(method) || MBeanInfoHelper.isSetterMethod(method) ||
MBeanInfoHelper.isIsBooleanMethod(method)) {
tempAttributes.add(MBeanInfoHelper.getAttributeInfo(method));
}
}
// since getters and setters will each have an MBeanAttributeInfo we need to de-duplicate
for (MBeanAttributeInfo info1 : tempAttributes) {
MBeanAttributeInfo infoToCopy = info1;
for (MBeanAttributeInfo info2 : tempAttributes) {
if (info1.getName().equals(info2.getName()) && !info1.equals(info2)) {
infoToCopy = new MBeanAttributeInfo(info1.getName(),
info1.getType().equals("void") ? info2.getType() : info1.getType(),
info1.getDescription(),
(info1.isReadable() || info2.isReadable()),
(info1.isWritable() || info2.isWritable()),
(info1.isIs() || info2.isIs()));
}
}
if (!alreadyAdded.contains(infoToCopy.getName())) {
finalAttributes.add(infoToCopy);
alreadyAdded.add(infoToCopy.getName());
}
}
return finalAttributes.toArray(new MBeanAttributeInfo[finalAttributes.size()]);
}
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@ -107,6 +142,29 @@ public class MBeanInfoHelper {
return info;
}
private static MBeanAttributeInfo getAttributeInfo(final Method operation) {
String description = "N/A";
if (operation.getAnnotation(Attribute.class) != null) {
description = operation.getAnnotation(Attribute.class).desc();
}
MBeanAttributeInfo info = new MBeanAttributeInfo(getAttributeName(operation), operation.getReturnType().getName(), description, (isGetterMethod(operation) || isIsBooleanMethod(operation)), isSetterMethod(operation), isIsBooleanMethod(operation));
return info;
}
private static String getAttributeName(Method operation) {
String name = operation.getName();
if (isGetterMethod(operation) || isSetterMethod(operation))
name = operation.getName().substring(3);
else if (isIsBooleanMethod(operation))
name = operation.getName().substring(2);
return name;
}
private static MBeanParameterInfo[] getParametersInfo(final Annotation[][] params, final Class<?>[] paramTypes) {
MBeanParameterInfo[] paramsInfo = new MBeanParameterInfo[params.length];

View File

@ -16,6 +16,7 @@
*/
package org.apache.activemq.artemis.core.management.impl;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanOperationInfo;
import javax.management.openmbean.CompositeData;
import java.util.ArrayList;
@ -980,6 +981,11 @@ public class QueueControlImpl extends AbstractControl implements QueueControl {
return MBeanInfoHelper.getMBeanOperationsInfo(QueueControl.class);
}
@Override
protected MBeanAttributeInfo[] fillMBeanAttributeInfo() {
return MBeanInfoHelper.getMBeanAttributesInfo(QueueControl.class);
}
@Override
public void resetMessagesAdded() throws Exception {
checkStarted();