    001    /*
    002     * Copyright 2009 Red Hat, Inc.
    003     * Red Hat licenses this file to you under the Apache License, version
    004     * 2.0 (the "License"); you may not use this file except in compliance
    005     * with the License.  You may obtain a copy of the License at
    006     *    http://www.apache.org/licenses/LICENSE-2.0
    007     * Unless required by applicable law or agreed to in writing, software
    008     * distributed under the License is distributed on an "AS IS" BASIS,
    009     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
    010     * implied.  See the License for the specific language governing
    011     * permissions and limitations under the License.
    012     */
    013
    014    package org.hornetq.api.jms.management;
    015
    016    import java.util.Map;
    017
    018    import javax.management.MBeanOperationInfo;
    019
    020    import org.hornetq.api.core.TransportConfiguration;
    021    import org.hornetq.api.core.client.ClientSessionFactory;
    022    import org.hornetq.api.core.management.Operation;
    023    import org.hornetq.api.core.management.Parameter;
    024    import org.hornetq.spi.core.remoting.ConnectorFactory;
    025
    026    /**
    027     * A JMSSserverControl is used to manage HornetQ JMS server.
    028     *
    029     * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
    030     * @author <a href="mailto:tim.fox@jboss.com">Tim Fox</a>
    031     */
    032    public interface JMSServerControl
    033    {
    034       // Attributes ----------------------------------------------------
    035
    036       /**
    037        * Returns whether this server is started.
    038        */
    039       boolean isStarted();
    040
    041       /**
    042        * Returns this server's version
    043        */
    044       String getVersion();
    045
    046       /**
    047        * Returns the names of the JMS topics available on this server.
    048        */
    049       String[] getTopicNames();
    050
    051       /**
    052        * Returns the names of the JMS queues available on this server.
    053        */
    054       String[] getQueueNames();
    055
    056       /**
    057        * Returns the names of the JMS connection factories available on this server.
    058        */
    059       String[] getConnectionFactoryNames();
    060
    061       // Operations ----------------------------------------------------
    062       /**
    063           * Creates a durable JMS Queue.
    064           *
    065           * @return {@code true} if the queue was created, {@code false} else
    066           */
    067       @Operation(desc = "Create a JMS Queue", impact = MBeanOperationInfo.ACTION)
    068       boolean createQueue(@Parameter(name = "name", desc = "Name of the queue to create") String name) throws Exception;
    069
    070       /**
    071        * Creates a durable JMS Queue with the specified name and JNDI binding.
    072        *
    073        * @return {@code true} if the queue was created, {@code false} else
    074        */
    075       @Operation(desc = "Create a JMS Queue", impact = MBeanOperationInfo.ACTION)
    076       boolean createQueue(@Parameter(name = "name", desc = "Name of the queue to create") String name,
    077                           @Parameter(name = "jndiBindings", desc = "comma-separated list of JNDI bindings (use '&comma;' if u need to use commas in your jndi name)") String jndiBindings) throws Exception;
    078
    079       /**
    080          * Creates a durable JMS Queue with the specified name, JNDI binding and selector.
    081          *
    082          * @return {@code true} if the queue was created, {@code false} else
    083          */
    084       @Operation(desc = "Create a JMS Queue", impact = MBeanOperationInfo.ACTION)
    085       boolean createQueue(@Parameter(name = "name", desc = "Name of the queue to create") String name,
    086                           @Parameter(name = "jndiBindings", desc = "comma-separated list of JNDI bindings (use '&comma;' if u need to use commas in your jndi name)") String jndiBindings,
    087                           @Parameter(name = "selector", desc = "the jms selector") String selector) throws Exception;
    088
    089       /**
    090        * Creates a JMS Queue with the specified name, durability, selector and JNDI binding.
    091        *
    092        * @return {@code true} if the queue was created, {@code false} else
    093        */
    094       @Operation(desc = "Create a JMS Queue", impact = MBeanOperationInfo.ACTION)
    095       boolean createQueue(@Parameter(name = "name", desc = "Name of the queue to create") String name,
    096                           @Parameter(name = "jndiBindings", desc = "comma-separated list of JNDI bindings (use '&comma;' if u need to use commas in your jndi name)") String jndiBindings,
    097                           @Parameter(name = "selector", desc = "the jms selector") String selector,
    098                           @Parameter(name = "durable", desc = "durability of the queue") boolean durable) throws Exception;
    099
    100       /**
    101        * Destroys a JMS Queue with the specified name.
    102        *
    103        * @return {@code true} if the queue was destroyed, {@code false} else
    104        */
    105       @Operation(desc = "Destroy a JMS Queue", impact = MBeanOperationInfo.ACTION)
    106       boolean destroyQueue(@Parameter(name = "name", desc = "Name of the queue to destroy") String name) throws Exception;
    107
    108       /**
    109        * Creates a JMS Topic.
    110        *
    111        * @return {@code true} if the topic was created, {@code false} else
    112        */
    113       @Operation(desc = "Create a JMS Topic", impact = MBeanOperationInfo.ACTION)
    114       boolean createTopic(@Parameter(name = "name", desc = "Name of the topic to create") String name) throws Exception;
    115
    116       /**
    117        * Creates a JMS Topic with the specified name and JNDI binding.
    118        *
    119        * @return {@code true} if the topic was created, {@code false} else
    120        */
    121       @Operation(desc = "Create a JMS Topic", impact = MBeanOperationInfo.ACTION)
    122       boolean createTopic(@Parameter(name = "name", desc = "Name of the topic to create") String name,
    123                           @Parameter(name = "jndiBindings", desc = "comma-separated list of JNDI bindings (use '&comma;' if u need to use commas in your jndi name)") String jndiBindings) throws Exception;
    124
    125       /**
    126        * Destroys a JMS Topic with the specified name.
    127        *
    128        * @return {@code true} if the topic was destroyed, {@code false} else
    129        */
    130       @Operation(desc = "Destroy a JMS Topic", impact = MBeanOperationInfo.ACTION)
    131       boolean destroyTopic(@Parameter(name = "name", desc = "Name of the topic to destroy") String name) throws Exception;
    132
    133       /**
    134        * Create a JMS ConnectionFactory with the specified name connected to a static list of live-backup servers.
    135        * <br>
    136        * The ConnectionFactory is bound to JNDI for all the specified bindings Strings.
    137        * <br>
    138        * {@code liveConnectorsTransportClassNames}  are the class names
    139        * of the {@link ConnectorFactory} to connect to the live servers
    140        * and {@code liveConnectorTransportParams}  are Map&lt;String, Object&gt; for the corresponding {@link TransportConfiguration}'s parameters.
    141        *
    142        * @see ClientSessionFactory#setStaticConnectors(java.util.List)
    143        */
    144       void createConnectionFactory(String name,
    145                                    boolean ha,
    146                                    boolean useDiscovery,
    147                                    @Parameter(name = "cfType", desc = "RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int cfType,
    148                                    String[] connectorNames,
    149                                    Object[] bindings) throws Exception;
    150
    151       /**
    152        * Create a JMS ConnectionFactory with the specified name connected to a single live-backup pair of servers.
    153        * <br>
    154        * The ConnectionFactory is bound to JNDI for all the specified bindings Strings.
    155        *
    156        */
    157       @Operation(desc = "Create a JMS ConnectionFactory", impact = MBeanOperationInfo.ACTION)
    158       void createConnectionFactory(@Parameter(name = "name") String name,
    159                                    @Parameter(name = "ha") boolean ha,
    160                                    @Parameter(name = "useDiscovery", desc = "should we use discovery or a connector configuration") boolean useDiscovery,
    161                                    @Parameter(name = "cfType", desc = "RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int cfType,
    162                                    @Parameter(name = "connectorNames", desc = "comma-separated list of connectorNames or the discovery group name") String connectors,
    163                                    @Parameter(name = "jndiBindings", desc = "comma-separated list of JNDI bindings (use '&comma;' if u need to use commas in your jndi name)") String jndiBindings) throws Exception;
    164
    165       @Operation(desc = "Create a JMS ConnectionFactory", impact = MBeanOperationInfo.ACTION)
    166       void createConnectionFactory(@Parameter(name = "name") String name,
    167                                    @Parameter(name = "ha") boolean ha,
    168                                    @Parameter(name = "useDiscovery", desc = "should we use discovery or a connector configuration") boolean useDiscovery,
    169                                    @Parameter(name = "cfType", desc = "RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int cfType,
    170                                    @Parameter(name = "connectorNames", desc = "An array of connector or the binding address") String[] connectors,
    171                                    @Parameter(name = "jndiBindings", desc = "array JNDI bindings (use '&comma;' if u need to use commas in your jndi name)") String[] jndiBindings,
    172                                    @Parameter(name = "clientID", desc = "The clientID configured for the connectionFactory") String clientID,
    173                                    @Parameter(name = "clientFailureCheckPeriod", desc = "clientFailureCheckPeriod") long clientFailureCheckPeriod,
    174                                    @Parameter(name = "connectionTTL", desc = "connectionTTL") long connectionTTL,
    175                                    @Parameter(name = "callTimeout", desc = "callTimeout") long callTimeout,
    176                                    @Parameter(name = "minLargeMessageSize", desc = "minLargeMessageSize") int minLargeMessageSize,
    177                                    @Parameter(name = "compressLargeMessages", desc = "compressLargeMessages") boolean compressLargeMessages,
    178                                    @Parameter(name = "consumerWindowSize", desc = "consumerWindowSize") int consumerWindowSize,
    179                                    @Parameter(name = "consumerMaxRate", desc = "consumerMaxRate") int consumerMaxRate,
    180                                    @Parameter(name = "confirmationWindowSize", desc = "confirmationWindowSize") int confirmationWindowSize,
    181                                    @Parameter(name = "producerWindowSize", desc = "producerWindowSize") int producerWindowSize,
    182                                    @Parameter(name = "producerMaxRate", desc = "producerMaxRate") int producerMaxRate,
    183                                    @Parameter(name = "blockOnAcknowledge", desc = "blockOnAcknowledge") boolean blockOnAcknowledge,
    184                                    @Parameter(name = "blockOnDurableSend", desc = "blockOnDurableSend") boolean blockOnDurableSend,
    185                                    @Parameter(name = "blockOnNonDurableSend", desc = "blockOnNonDurableSend") boolean blockOnNonDurableSend,
    186                                    @Parameter(name = "autoGroup", desc = "autoGroup") boolean autoGroup,
    187                                    @Parameter(name = "preAcknowledge", desc = "preAcknowledge") boolean preAcknowledge,
    188                                    @Parameter(name = "loadBalancingPolicyClassName", desc = "loadBalancingPolicyClassName (null or blank mean use the default value)") String loadBalancingPolicyClassName,
    189                                    @Parameter(name = "transactionBatchSize", desc = "transactionBatchSize") int transactionBatchSize,
    190                                    @Parameter(name = "dupsOKBatchSize", desc = "dupsOKBatchSize") int dupsOKBatchSize,
    191                                    @Parameter(name = "useGlobalPools", desc = "useGlobalPools") boolean useGlobalPools,
    192                                    @Parameter(name = "scheduledThreadPoolMaxSize", desc = "scheduledThreadPoolMaxSize") int scheduledThreadPoolMaxSize,
    193                                    @Parameter(name = "threadPoolMaxSize", desc = "threadPoolMaxSize") int threadPoolMaxSize,
    194                                    @Parameter(name = "retryInterval", desc = "retryInterval") long retryInterval,
    195                                    @Parameter(name = "retryIntervalMultiplier", desc = "retryIntervalMultiplier") double retryIntervalMultiplier,
    196                                    @Parameter(name = "maxRetryInterval", desc = "maxRetryInterval") long maxRetryInterval,
    197                                    @Parameter(name = "reconnectAttempts", desc = "reconnectAttempts") int reconnectAttempts,
    198                                    @Parameter(name = "failoverOnInitialConnection", desc = "failoverOnInitialConnection") boolean failoverOnInitialConnection,
    199                                    @Parameter(name = "groupId", desc = "groupId") String groupId) throws Exception;
    200
    201
    202       @Operation(desc = "Create a JMS ConnectionFactory", impact = MBeanOperationInfo.ACTION)
    203       void createConnectionFactory(@Parameter(name = "name") String name,
    204                                    @Parameter(name = "ha") boolean ha,
    205                                    @Parameter(name = "useDiscovery", desc = "should we use discovery or a connector configuration") boolean useDiscovery,
    206                                    @Parameter(name = "cfType", desc = "RegularCF=0, QueueCF=1, TopicCF=2, XACF=3, QueueXACF=4, TopicXACF=5") int cfType,
    207                                    @Parameter(name = "connectorNames", desc = "comma-separated list of connectorNames or the discovery group name") String connectors,
    208                                    @Parameter(name = "jndiBindings", desc = "comma-separated list of JNDI bindings (use '&comma;' if u need to use commas in your jndi name)") String jndiBindings,
    209                                    @Parameter(name = "clientID", desc = "The clientID configured for the connectionFactory") String clientID,
    210                                    @Parameter(name = "clientFailureCheckPeriod", desc = "clientFailureCheckPeriod") long clientFailureCheckPeriod,
    211                                    @Parameter(name = "connectionTTL", desc = "connectionTTL") long connectionTTL,
    212                                    @Parameter(name = "callTimeout", desc = "callTimeout") long callTimeout,
    213                                    @Parameter(name = "minLargeMessageSize", desc = "minLargeMessageSize") int minLargeMessageSize,
    214                                    @Parameter(name = "compressLargeMessages", desc = "compressLargeMessages") boolean compressLargeMessages,
    215                                    @Parameter(name = "consumerWindowSize", desc = "consumerWindowSize") int consumerWindowSize,
    216                                    @Parameter(name = "consumerMaxRate", desc = "consumerMaxRate") int consumerMaxRate,
    217                                    @Parameter(name = "confirmationWindowSize", desc = "confirmationWindowSize") int confirmationWindowSize,
    218                                    @Parameter(name = "producerWindowSize", desc = "producerWindowSize") int producerWindowSize,
    219                                    @Parameter(name = "producerMaxRate", desc = "producerMaxRate") int producerMaxRate,
    220                                    @Parameter(name = "blockOnAcknowledge", desc = "blockOnAcknowledge") boolean blockOnAcknowledge,
    221                                    @Parameter(name = "blockOnDurableSend", desc = "blockOnDurableSend") boolean blockOnDurableSend,
    222                                    @Parameter(name = "blockOnNonDurableSend", desc = "blockOnNonDurableSend") boolean blockOnNonDurableSend,
    223                                    @Parameter(name = "autoGroup", desc = "autoGroup") boolean autoGroup,
    224                                    @Parameter(name = "preAcknowledge", desc = "preAcknowledge") boolean preAcknowledge,
    225                                    @Parameter(name = "loadBalancingPolicyClassName", desc = "loadBalancingPolicyClassName (null or blank mean use the default value)") String loadBalancingPolicyClassName,
    226                                    @Parameter(name = "transactionBatchSize", desc = "transactionBatchSize") int transactionBatchSize,
    227                                    @Parameter(name = "dupsOKBatchSize", desc = "dupsOKBatchSize") int dupsOKBatchSize,
    228                                    @Parameter(name = "useGlobalPools", desc = "useGlobalPools") boolean useGlobalPools,
    229                                    @Parameter(name = "scheduledThreadPoolMaxSize", desc = "scheduledThreadPoolMaxSize") int scheduledThreadPoolMaxSize,
    230                                    @Parameter(name = "threadPoolMaxSize", desc = "threadPoolMaxSize") int threadPoolMaxSize,
    231                                    @Parameter(name = "retryInterval", desc = "retryInterval") long retryInterval,
    232                                    @Parameter(name = "retryIntervalMultiplier", desc = "retryIntervalMultiplier") double retryIntervalMultiplier,
    233                                    @Parameter(name = "maxRetryInterval", desc = "maxRetryInterval") long maxRetryInterval,
    234                                    @Parameter(name = "reconnectAttempts", desc = "reconnectAttempts") int reconnectAttempts,
    235                                    @Parameter(name = "failoverOnInitialConnection", desc = "failoverOnInitialConnection") boolean failoverOnInitialConnection,
    236                                    @Parameter(name = "groupId", desc = "groupId") String groupId) throws Exception;
    237
    238
    239
    240       @Operation(desc = "Destroy a JMS ConnectionFactory", impact = MBeanOperationInfo.ACTION)
    241       void destroyConnectionFactory(@Parameter(name = "name", desc = "Name of the ConnectionFactory to destroy") String name) throws Exception;
    242
    243       /**
    244        * Lists the addresses of all the clients connected to this address.
    245        */
    246       @Operation(desc = "List the client addresses", impact = MBeanOperationInfo.INFO)
    247       String[] listRemoteAddresses() throws Exception;
    248
    249       /**
    250        * Lists the addresses of the clients connected to this address which matches the specified IP address.
    251        */
    252       @Operation(desc = "List the client addresses which match the given IP Address", impact = MBeanOperationInfo.INFO)
    253       String[] listRemoteAddresses(@Parameter(desc = "an IP address", name = "ipAddress") String ipAddress) throws Exception;
    254
    255       /**
    256        * Closes all the connections of clients connected to this server which matches the specified IP address.
    257        */
    258       @Operation(desc = "Closes all the connections for the given IP Address", impact = MBeanOperationInfo.INFO)
    259       boolean closeConnectionsForAddress(@Parameter(desc = "an IP address", name = "ipAddress") String ipAddress) throws Exception;
    260
    261       /**
    262        * Lists all the IDs of the connections connected to this server.
    263        */
    264       @Operation(desc = "List all the connection IDs", impact = MBeanOperationInfo.INFO)
    265       String[] listConnectionIDs() throws Exception;
    266
    267       /**
    268        * Lists all the connections connected to this server.
    269        * The returned String is a JSON string containing an array of JMSConnectionInfo objects.
    270        *
    271        * @see JMSConnectionInfo#from(String)
    272        */
    273       @Operation(desc = "List all JMS connections")
    274       String listConnectionsAsJSON() throws Exception;
    275
    276       /**
    277        * Lists all the sessions IDs for the specified connection ID.
    278        */
    279       @Operation(desc = "List the sessions for the given connectionID", impact = MBeanOperationInfo.INFO)
    280       String[] listSessions(@Parameter(desc = "a connection ID", name = "connectionID") String connectionID) throws Exception;
    281
    282       /**
    283        * Lists all the consumers which belongs to the JMS Connection specified by the connectionID.
    284        * The returned String is a JSON string containing an array of JMSConsumerInfo objects.
    285        *
    286        * @see JMSConsumerInfo#from(String)
    287        */
    288       @Operation(desc = "List all JMS consumers associated to a JMS Connection")
    289       String listConsumersAsJSON(@Parameter(desc = "a connection ID", name = "connectionID") String connectionID) throws Exception;
    290
    291       /**
    292        * Lists all the consumers
    293        * The returned String is a JSON string containing an array of JMSConsumerInfo objects.
    294        *
    295        * @see JMSConsumerInfo#from(String)
    296        */
    297       @Operation(desc = "List all JMS consumers associated to a JMS Connection")
    298       String listAllConsumersAsJSON() throws Exception;
    299
    300       /**
    301        * Lists all addresses to which the designated server session has sent messages.
    302        */
    303       @Operation(desc = "Lists all addresses to which the designated session has sent messages", impact = MBeanOperationInfo.INFO)
    304       String[] listTargetDestinations(@Parameter(desc = "a session ID", name = "sessionID") String sessionID) throws Exception;
    305
    306       /**
    307        * Returns the last sent message's ID from the given session to an address.
    308        */
    309       @Operation(desc = "Returns the last sent message's ID from the given session to an address", impact = MBeanOperationInfo.INFO)
    310       String getLastSentMessageID(@Parameter(desc = "session name", name = "sessionID") String sessionID,
    311                                   @Parameter(desc = "address", name = "address") String address) throws Exception;
    312
    313       /**
    314        * Gets the session's creation time.
    315        */
    316       @Operation(desc = "Gets the sessions creation time", impact = MBeanOperationInfo.INFO)
    317       String getSessionCreationTime(@Parameter(desc = "session name", name = "sessionID") String sessionID) throws Exception;
    318
    319       /**
    320        * Lists all the sessions IDs for the specified connection ID.
    321        */
    322       @Operation(desc = "List the sessions for the given connectionID", impact = MBeanOperationInfo.INFO)
    323       String listSessionsAsJSON(@Parameter(desc = "a connection ID", name = "connectionID") String connectionID) throws Exception;
    324
    325       /**
    326        * List all the prepared transaction, sorted by date,
    327        * oldest first, with details, in text format
    328        */
    329       @Operation(desc = "List all the prepared transaction, sorted by date, oldest first, with details, in JSON format", impact = MBeanOperationInfo.INFO)
    330       String listPreparedTransactionDetailsAsJSON() throws Exception;
    331
    332       /**
    333        * List all the prepared transaction, sorted by date,
    334        * oldest first, with details, in HTML format
    335        */
    336       @Operation(desc = "List all the prepared transaction, sorted by date, oldest first, with details, in HTML format", impact = MBeanOperationInfo.INFO)
    337       String listPreparedTransactionDetailsAsHTML() throws Exception;
    338    }