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.core.management; 015 016 import javax.management.MBeanOperationInfo; 017 018 import org.hornetq.api.core.HornetQException; 019 import org.hornetq.api.core.Interceptor; 020 021 /** 022 * A HornetQServerControl is used to manage HornetQ servers. 023 */ 024 public interface HornetQServerControl 025 { 026 // Attributes ---------------------------------------------------- 027 028 /** 029 * Returns the name of the connector used to connect to the backup. 030 * <br> 031 * If this server has no backup or is itself a backup, the value is {@code null}. 032 */ 033 String getBackupConnectorName(); 034 035 /** 036 * Returns this server's version. 037 */ 038 String getVersion(); 039 040 /** 041 * Returns the number of connections connected to this server. 042 */ 043 int getConnectionCount(); 044 045 /** 046 * Return whether this server is started. 047 */ 048 boolean isStarted(); 049 050 /** 051 * Returns the list of interceptors used by this server. 052 * 053 * @see Interceptor 054 */ 055 String[] getInterceptorClassNames(); 056 057 /** 058 * Returns whether this server is clustered. 059 */ 060 boolean isClustered(); 061 062 /** 063 * Returns the maximum number of threads in the <em>scheduled</em> thread pool. 064 */ 065 int getScheduledThreadPoolMaxSize(); 066 067 /** 068 * Returns the maximum number of threads in the thread pool. 069 */ 070 int getThreadPoolMaxSize(); 071 072 /** 073 * Returns the interval time (in milliseconds) to invalidate security credentials. 074 */ 075 long getSecurityInvalidationInterval(); 076 077 /** 078 * Returns whether security is enabled for this server. 079 */ 080 boolean isSecurityEnabled(); 081 082 /** 083 * Returns the file system directory used to store bindings. 084 */ 085 String getBindingsDirectory(); 086 087 /** 088 * Returns the file system directory used to store journal log. 089 */ 090 String getJournalDirectory(); 091 092 /** 093 * Returns the type of journal used by this server (either {@code NIO} or {@code ASYNCIO}). 094 */ 095 String getJournalType(); 096 097 /** 098 * Returns whether the journal is synchronized when receiving transactional data. 099 */ 100 boolean isJournalSyncTransactional(); 101 102 /** 103 * Returns whether the journal is synchronized when receiving non-transactional data. 104 */ 105 boolean isJournalSyncNonTransactional(); 106 107 /** 108 * Returns the size (in bytes) of each journal files. 109 */ 110 int getJournalFileSize(); 111 112 /** 113 * Returns the number of journal files to pre-create. 114 */ 115 int getJournalMinFiles(); 116 117 /** 118 * Returns the maximum number of write requests that can be in the AIO queue at any given time. 119 */ 120 int getJournalMaxIO(); 121 122 /** 123 * Returns the size of the internal buffer on the journal. 124 */ 125 int getJournalBufferSize(); 126 127 /** 128 * Returns the timeout (in nanoseconds) used to flush internal buffers on the journal. 129 */ 130 int getJournalBufferTimeout(); 131 132 /** 133 * Returns the minimal number of journal files before compacting. 134 */ 135 int getJournalCompactMinFiles(); 136 137 /** 138 * Return the percentage of live data before compacting the journal. 139 */ 140 int getJournalCompactPercentage(); 141 142 /** 143 * Returns whether this server is using persistence and store data. 144 */ 145 boolean isPersistenceEnabled(); 146 147 /** 148 * Returns whether the bindings directory is created on this server startup. 149 */ 150 boolean isCreateBindingsDir(); 151 152 /** 153 * Returns whether the journal directory is created on this server startup. 154 */ 155 boolean isCreateJournalDir(); 156 157 /** 158 * Returns whether message counter is enabled for this server. 159 */ 160 boolean isMessageCounterEnabled(); 161 162 /** 163 * Returns the maximum number of days kept in memory for message counter. 164 */ 165 int getMessageCounterMaxDayCount(); 166 167 /** 168 * Sets the maximum number of days kept in memory for message counter. 169 * 170 * @param count value must be greater than 0 171 */ 172 void setMessageCounterMaxDayCount(int count) throws Exception; 173 174 /** 175 * Returns the sample period (in milliseconds) to take message counter snapshot. 176 */ 177 long getMessageCounterSamplePeriod(); 178 179 /** 180 * Sets the sample period to take message counter snapshot. 181 * 182 * @param newPeriod value must be greater than 1000ms 183 */ 184 void setMessageCounterSamplePeriod(long newPeriod) throws Exception; 185 186 /** 187 * Returns {@code true} if this server is a backup, {@code false} if it is a live server. 188 * <br> 189 * If a backup server has been activated, returns {@code false}. 190 */ 191 boolean isBackup(); 192 193 /** 194 * Returns whether this server shares its data store with a corresponding live or backup server. 195 */ 196 boolean isSharedStore(); 197 198 /** 199 * Returns the file system directory used to store paging files. 200 */ 201 String getPagingDirectory(); 202 203 /** 204 * Returns whether delivery count is persisted before messages are delivered to the consumers. 205 */ 206 boolean isPersistDeliveryCountBeforeDelivery(); 207 208 /** 209 * Returns the connection time to live. 210 * <br> 211 * This value overrides the connection time to live <em>sent by the client</em>. 212 */ 213 long getConnectionTTLOverride(); 214 215 /** 216 * Returns the management address of this server. 217 * <br> 218 * Clients can send management messages to this address to manage this server. 219 */ 220 String getManagementAddress(); 221 222 /** 223 * Returns the management notification address of this server. 224 * <br> 225 * Clients can bind queues to this address to receive management notifications emitted by this server. 226 */ 227 String getManagementNotificationAddress(); 228 229 /** 230 * Returns the size of the cache for pre-creating message IDs. 231 */ 232 int getIDCacheSize(); 233 234 /** 235 * Returns whether message ID cache is persisted. 236 */ 237 boolean isPersistIDCache(); 238 239 /** 240 * Returns the file system directory used to store large messages. 241 */ 242 String getLargeMessagesDirectory(); 243 244 /** 245 * Returns whether wildcard routing is supported by this server. 246 */ 247 boolean isWildcardRoutingEnabled(); 248 249 /** 250 * Returns the timeout (in milliseconds) after which transactions is removed 251 * from the resource manager after it was created. 252 */ 253 long getTransactionTimeout(); 254 255 /** 256 * Returns the frequency (in milliseconds) to scan transactions to detect which transactions 257 * have timed out. 258 */ 259 long getTransactionTimeoutScanPeriod(); 260 261 /** 262 * Returns the frequency (in milliseconds) to scan messages to detect which messages 263 * have expired. 264 */ 265 long getMessageExpiryScanPeriod(); 266 267 /** 268 * Returns the priority of the thread used to scan message expiration. 269 */ 270 long getMessageExpiryThreadPriority(); 271 272 /** 273 * Returns whether code coming from connection is executed asynchronously or not. 274 */ 275 boolean isAsyncConnectionExecutionEnabled(); 276 277 /** 278 * Returns the connectors configured for this server. 279 */ 280 Object[] getConnectors() throws Exception; 281 282 /** 283 * Returns the connectors configured for this server using JSON serialization. 284 */ 285 String getConnectorsAsJSON() throws Exception; 286 287 /** 288 * Returns the addresses created on this server. 289 */ 290 String[] getAddressNames(); 291 292 /** 293 * Returns the names of the queues created on this server. 294 */ 295 String[] getQueueNames(); 296 297 // Operations ---------------------------------------------------- 298 299 /** 300 * Create a durable queue. 301 * <br> 302 * This method throws a {@link HornetQException#QUEUE_EXISTS}) exception if the queue already exits. 303 * 304 * @param address address to bind the queue to 305 * @param name name of the queue 306 */ 307 @Operation(desc = "Create a queue with the specified address", impact = MBeanOperationInfo.ACTION) 308 void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, 309 @Parameter(name = "name", desc = "Name of the queue") String name) throws Exception; 310 311 /** 312 * Create a queue. 313 * <br> 314 * This method throws a {@link HornetQException#QUEUE_EXISTS}) exception if the queue already exits. 315 * 316 * @param address address to bind the queue to 317 * @param name name of the queue 318 * @param filter of the queue 319 * @param durable whether the queue is durable 320 */ 321 @Operation(desc = "Create a queue", impact = MBeanOperationInfo.ACTION) 322 void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, 323 @Parameter(name = "name", desc = "Name of the queue") String name, 324 @Parameter(name = "filter", desc = "Filter of the queue") String filter, 325 @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable) throws Exception; 326 327 /** 328 * Create a queue. 329 * <br> 330 * This method throws a {@link HornetQException#QUEUE_EXISTS}) exception if the queue already exits. 331 * 332 * @param address address to bind the queue to 333 * @param name name of the queue 334 * @param durable whether the queue is durable 335 */ 336 @Operation(desc = "Create a queue with the specified address, name and durability", impact = MBeanOperationInfo.ACTION) 337 void createQueue(@Parameter(name = "address", desc = "Address of the queue") String address, 338 @Parameter(name = "name", desc = "Name of the queue") String name, 339 @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable) throws Exception; 340 341 /** 342 * Deploy a durable queue. 343 * <br> 344 * This method will do nothing if the queue with the given name already exists on the server. 345 * 346 * @param address address to bind the queue to 347 * @param name name of the queue 348 * @param filter of the queue 349 */ 350 @Operation(desc = "Deploy a queue", impact = MBeanOperationInfo.ACTION) 351 void deployQueue(@Parameter(name = "address", desc = "Address of the queue") String address, 352 @Parameter(name = "name", desc = "Name of the queue") String name, 353 @Parameter(name = "filter", desc = "Filter of the queue")String filter) throws Exception; 354 355 /** 356 * Deploy a queue. 357 * <br> 358 * This method will do nothing if the queue with the given name already exists on the server. 359 * 360 * @param address address to bind the queue to 361 * @param name name of the queue 362 * @param filter of the queue 363 * @param durable whether the queue is durable 364 */ 365 @Operation(desc = "Deploy a queue", impact = MBeanOperationInfo.ACTION) 366 void deployQueue(@Parameter(name = "address", desc = "Address of the queue") String address, 367 @Parameter(name = "name", desc = "Name of the queue") String name, 368 @Parameter(name = "filter", desc = "Filter of the queue") String filter, 369 @Parameter(name = "durable", desc = "Is the queue durable?") boolean durable) throws Exception; 370 371 /** 372 * Destroys the queue corresponding to the specified name. 373 */ 374 @Operation(desc = "Destroy a queue", impact = MBeanOperationInfo.ACTION) 375 void destroyQueue(@Parameter(name = "name", desc = "Name of the queue to destroy") String name) throws Exception; 376 377 /** 378 * Enables message counters for this server. 379 */ 380 @Operation(desc = "Enable message counters", impact = MBeanOperationInfo.ACTION) 381 void enableMessageCounters() throws Exception; 382 383 /** 384 * Disables message counters for this server. 385 */ 386 @Operation(desc = "Disable message counters", impact = MBeanOperationInfo.ACTION) 387 void disableMessageCounters() throws Exception; 388 389 /** 390 * Reset all message counters. 391 */ 392 @Operation(desc = "Reset all message counters", impact = MBeanOperationInfo.ACTION) 393 void resetAllMessageCounters() throws Exception; 394 395 /** 396 * Reset histories for all message counters. 397 */ 398 @Operation(desc = "Reset all message counters history", impact = MBeanOperationInfo.ACTION) 399 void resetAllMessageCounterHistories() throws Exception; 400 401 /** 402 * List all the prepared transaction, sorted by date, oldest first. 403 * <br> 404 * The Strings are Base-64 representation of the transaction XID and can be 405 * used to heuristically commit or rollback the transactions. 406 * 407 * @see #commitPreparedTransaction(String) 408 * @see #rollbackPreparedTransaction(String) 409 */ 410 @Operation(desc = "List all the prepared transaction, sorted by date, oldest first") 411 String[] listPreparedTransactions() throws Exception; 412 413 /** 414 * List transactions which have been heuristically committed. 415 */ 416 String[] listHeuristicCommittedTransactions() throws Exception; 417 418 /** 419 * List transactions which have been heuristically rolled back. 420 */ 421 String[] listHeuristicRolledBackTransactions() throws Exception; 422 423 /** 424 * Heuristically commits a prepared transaction. 425 * 426 * @param transactionAsBase64 base 64 representation of a prepare transaction 427 * @return {@code true} if the transaction was successfully committed, {@code false} else 428 * 429 * @see #listPreparedTransactions() 430 */ 431 @Operation(desc = "Commit a prepared transaction") 432 boolean commitPreparedTransaction(@Parameter(desc = "the Base64 representation of a transaction", name = "transactionAsBase64") String transactionAsBase64) throws Exception; 433 434 /** 435 * Heuristically rolls back a prepared transaction. 436 * 437 * @param transactionAsBase64 base 64 representation of a prepare transaction 438 * @return {@code true} if the transaction was successfully rolled back, {@code false} else 439 * 440 * @see #listPreparedTransactions() 441 */ 442 @Operation(desc = "Rollback a prepared transaction") 443 boolean rollbackPreparedTransaction(@Parameter(desc = "the Base64 representation of a transaction", name = "transactionAsBase64") String transactionAsBase64) throws Exception; 444 445 /** 446 * Lists the addresses of all the clients connected to this address. 447 */ 448 @Operation(desc = "List the client addresses", impact = MBeanOperationInfo.INFO) 449 String[] listRemoteAddresses() throws Exception; 450 451 /** 452 * Lists the addresses of the clients connected to this address which matches the specified IP address. 453 */ 454 @Operation(desc = "List the client addresses which match the given IP Address", impact = MBeanOperationInfo.INFO) 455 String[] listRemoteAddresses(@Parameter(desc = "an IP address", name = "ipAddress") String ipAddress) throws Exception; 456 457 /** 458 * Closes all the connections of clients connected to this server which matches the specified IP address. 459 */ 460 @Operation(desc = "Closes all the connections for the given IP Address", impact = MBeanOperationInfo.INFO) 461 boolean closeConnectionsForAddress(@Parameter(desc = "an IP address", name = "ipAddress") String ipAddress) throws Exception; 462 463 /** 464 * Lists all the IDs of the connections connected to this server. 465 */ 466 @Operation(desc = "List all the connection IDs", impact = MBeanOperationInfo.INFO) 467 String[] listConnectionIDs() throws Exception; 468 469 /** 470 * Lists all the sessions IDs for the specified connection ID. 471 */ 472 @Operation(desc = "List the sessions for the given connectionID", impact = MBeanOperationInfo.INFO) 473 String[] listSessions(@Parameter(desc = "a connection ID", name = "connectionID") String connectionID) throws Exception; 474 475 /** 476 * This method is used by HornetQ clustering and must not be called by HornetQ clients. 477 */ 478 void sendQueueInfoToQueue(String queueName, String address) throws Exception; 479 480 @Operation(desc= "Add security settings for addresses matching the addressMatch", impact = MBeanOperationInfo.ACTION) 481 void addSecuritySettings( 482 @Parameter(desc="an address match", name="addressMatch") String addressMatch, 483 @Parameter(desc="a comma-separated list of roles allowed to send messages", name="send") String sendRoles, 484 @Parameter(desc="a comma-separated list of roles allowed to consume messages", name="consume") String consumeRoles, 485 @Parameter(desc="a comma-separated list of roles allowed to create durable queues", name="createDurableQueueRoles") String createDurableQueueRoles, 486 @Parameter(desc="a comma-separated list of roles allowed to delete durable queues", name="deleteDurableQueueRoles") String deleteDurableQueueRoles, 487 @Parameter(desc="a comma-separated list of roles allowed to create non durable queues", name="createNonDurableQueueRoles") String createNonDurableQueueRoles, 488 @Parameter(desc="a comma-separated list of roles allowed to delete non durable queues", name="deleteNonDurableQueueRoles") String deleteNonDurableQueueRoles, 489 @Parameter(desc="a comma-separated list of roles allowed to send management messages messages", name="manage") String manageRoles) throws Exception; 490 491 @Operation(desc = "Remove security settings for an address", impact = MBeanOperationInfo.ACTION) 492 void removeSecuritySettings(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch) throws Exception; 493 494 @Operation(desc = "get roles for a specific address match", impact = MBeanOperationInfo.INFO) 495 Object[] getRoles(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch) throws Exception; 496 497 @Operation(desc = "get roles (as a JSON string) for a specific address match", impact = MBeanOperationInfo.INFO) 498 String getRolesAsJSON(@Parameter(desc = "an address match", name = "addressMatch") String addressMatch) throws Exception; 499 500 /** 501 * adds a new address setting for a specific address 502 */ 503 @Operation(desc= "Add address settings for addresses matching the addressMatch", impact = MBeanOperationInfo.ACTION) 504 void addAddressSettings(@Parameter(desc="an address match", name="addressMatch") String addressMatch, 505 @Parameter(desc="the dead letter address setting", name="DLA") String DLA, 506 @Parameter(desc="the expiry address setting", name="expiryAddress") String expiryAddress, 507 @Parameter(desc="are any queues created for this address a last value queue", name="lastValueQueue") boolean lastValueQueue, 508 @Parameter(desc="the delivery attempts", name="deliveryAttempts") int deliveryAttempts, 509 @Parameter(desc="the max size in bytes", name="maxSizeBytes") long maxSizeBytes, 510 @Parameter(desc="the page size in bytes", name="pageSizeBytes") int pageSizeBytes, 511 @Parameter(desc="the redelivery delay", name="redeliveryDelay") long redeliveryDelay, 512 @Parameter(desc="the redistribution delay", name="redistributionDelay") long redistributionDelay, 513 @Parameter(desc="do we send to the DLA when there is no where to route the message", name="sendToDLAOnNoRoute") boolean sendToDLAOnNoRoute, 514 @Parameter(desc="the ploicy to use when the address is full", name="addressFullMessagePolicy") String addressFullMessagePolicy) throws Exception; 515 516 void removeAddressSettings(String addressMatch) throws Exception; 517 518 /** 519 * returns the address settings as a JSON string 520 */ 521 @Operation(desc = "returns the address settings as a JSON string for an address match", impact = MBeanOperationInfo.INFO) 522 String getAddressSettingsAsJSON(@Parameter(desc="an address match", name="addressMatch") String addressMatch) throws Exception; 523 524 String[] getDivertNames(); 525 526 @Operation(desc= "Create a Divert", impact = MBeanOperationInfo.ACTION) 527 void createDivert(@Parameter(name="name", desc="Name of the divert") String name, 528 @Parameter(name="routingName", desc="Routing name of the divert") String routingName, 529 @Parameter(name="address", desc="Address to divert from") String address, 530 @Parameter(name="forwardingAddress", desc="Adress to divert to") String forwardingAddress, 531 @Parameter(name="exclusive", desc="Is the divert exclusive?") boolean exclusive, 532 @Parameter(name="filterString", desc="Filter of the divert") String filterString, 533 @Parameter(name="transformerClassName", desc="Class name of the divert's transformer") String transformerClassName) throws Exception; 534 535 @Operation(desc= "Destroy a Divert", impact = MBeanOperationInfo.ACTION) 536 void destroyDivert(@Parameter(name="name", desc="Name of the divert") String name) throws Exception; 537 538 String[] getBridgeNames(); 539 540 @Operation(desc= "Create a Bridge using a pair of connectors", impact = MBeanOperationInfo.ACTION) 541 void createBridge(@Parameter(name="name", desc="Name of the bridge") String name, 542 @Parameter(name="queueName", desc="Name of the source queue") String queueName, 543 @Parameter(name="forwardingAddress", desc="Forwarding address") String forwardingAddress, 544 @Parameter(name="filterString", desc="Filter of the brdige") String filterString, 545 @Parameter(name="transformerClassName", desc="Class name of the bridge transformer") String transformerClassName, 546 @Parameter(name="retryInterval", desc="Connection retry interval") long retryInterval, 547 @Parameter(name="retryIntervalMultiplier", desc="Connection retry interval multiplier") double retryIntervalMultiplier, 548 @Parameter(name="reconnectAttempts", desc="Number of reconnection attempts") int reconnectAttempts, 549 @Parameter(name="failoverOnServerShutdown", desc="Failover when the server shuts down?") boolean failoverOnServerShutdown, 550 @Parameter(name="useDuplicateDetection", desc="Use duplicate detection") boolean useDuplicateDetection, 551 @Parameter(name="confirmationWindowSize", desc="Confirmation window size") int confirmationWindowSize, 552 @Parameter(name="clientFailureCheckPeriod", desc="Period to check client failure") long clientFailureCheckPeriod, 553 @Parameter(name="liveConnector", desc="Name of the connector to the live server") String liveConnector, 554 @Parameter(name="backupConnector", desc="Name of the connector to the backup server") String backupConnector, 555 @Parameter(name="user", desc="User name") String user, 556 @Parameter(name="password", desc="User password") String password) throws Exception; 557 558 @Operation(desc= "Create a Bridge using a discovery group", impact = MBeanOperationInfo.ACTION) 559 void createBridge(@Parameter(name="name", desc="Name of the bridge") String name, 560 @Parameter(name="queueName", desc="Name of the source queue") String queueName, 561 @Parameter(name="forwardingAddress", desc="Forwarding address") String forwardingAddress, 562 @Parameter(name="filterString", desc="Filter of the brdige") String filterString, 563 @Parameter(name="transformerClassName", desc="Class name of the bridge transformer") String transformerClassName, 564 @Parameter(name="retryInterval", desc="Connection retry interval") long retryInterval, 565 @Parameter(name="retryIntervalMultiplier", desc="Connection retry interval multiplier") double retryIntervalMultiplier, 566 @Parameter(name="reconnectAttempts", desc="Number of reconnection attempts") int reconnectAttempts, 567 @Parameter(name="failoverOnServerShutdown", desc="Failover when the server shuts down?") boolean failoverOnServerShutdown, 568 @Parameter(name="useDuplicateDetection", desc="Use duplicate detection") boolean useDuplicateDetection, 569 @Parameter(name="confirmationWindowSize", desc="Confirmation window size") int confirmationWindowSize, 570 @Parameter(name="clientFailureCheckPeriod", desc="Period to check client failure") long clientFailureCheckPeriod, 571 @Parameter(name="name", desc="Name of the discovery group") String discoveryGroupName, 572 @Parameter(name="user", desc="User name") String user, 573 @Parameter(name="password", desc="User password") String password) throws Exception; 574 575 @Operation(desc= "Destroy a bridge", impact = MBeanOperationInfo.ACTION) 576 void destroyBridge(@Parameter(name="name", desc="Name of the bridge") String name) throws Exception; 577 }