| <!DOCTYPE HTML> |
| <html lang="en" > |
| |
| <head> |
| |
| <meta charset="UTF-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| <title>Management | ActiveMQ Artemis Documentation</title> |
| <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> |
| <meta name="description" content=""> |
| <meta name="generator" content="GitBook 2.1.0"> |
| |
| |
| <meta name="HandheldFriendly" content="true"/> |
| <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no"> |
| <meta name="apple-mobile-web-app-capable" content="yes"> |
| <meta name="apple-mobile-web-app-status-bar-style" content="black"> |
| <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png"> |
| <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon"> |
| |
| <link rel="stylesheet" href="gitbook/style.css"> |
| |
| |
| |
| |
| |
| |
| <link rel="next" href="./security.html" /> |
| |
| |
| <link rel="prev" href="./pre-acknowledge.html" /> |
| |
| |
| |
| </head> |
| <body> |
| |
| |
| <div class="book" data-level="31" data-basepath="." data-revision="Wed Jun 08 2016 13:05:37 GMT+0100 (BST)"> |
| |
| |
| <div class="book-summary"> |
| <div class="book-search"> |
| <input type="text" placeholder="Type to search" class="form-control" /> |
| </div> |
| <ul class="summary"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <li class="chapter " data-level="0" data-path="index.html"> |
| |
| |
| <a href="./index.html"> |
| <i class="fa fa-check"></i> |
| |
| Introduction |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1" data-path="notice.html"> |
| |
| |
| <a href="./notice.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>1.</b> |
| |
| Legal Notice |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="2" data-path="preface.html"> |
| |
| |
| <a href="./preface.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>2.</b> |
| |
| Preface |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="3" data-path="project-info.html"> |
| |
| |
| <a href="./project-info.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>3.</b> |
| |
| Project Info |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="4" data-path="messaging-concepts.html"> |
| |
| |
| <a href="./messaging-concepts.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>4.</b> |
| |
| Messaging Concepts |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="5" data-path="architecture.html"> |
| |
| |
| <a href="./architecture.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>5.</b> |
| |
| Architecture |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="6" data-path="using-server.html"> |
| |
| |
| <a href="./using-server.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>6.</b> |
| |
| Using the Server |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="7" data-path="using-jms.html"> |
| |
| |
| <a href="./using-jms.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>7.</b> |
| |
| Using JMS |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="8" data-path="using-core.html"> |
| |
| |
| <a href="./using-core.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>8.</b> |
| |
| Using Core |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="9" data-path="jms-core-mapping.html"> |
| |
| |
| <a href="./jms-core-mapping.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>9.</b> |
| |
| Mapping JMS Concepts to the Core API |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="10" data-path="client-classpath.html"> |
| |
| |
| <a href="./client-classpath.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>10.</b> |
| |
| The Client Classpath |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="11" data-path="examples.html"> |
| |
| |
| <a href="./examples.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>11.</b> |
| |
| Examples |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="12" data-path="wildcard-routing.html"> |
| |
| |
| <a href="./wildcard-routing.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>12.</b> |
| |
| Routing Messages With Wild Cards |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="13" data-path="wildcard-syntax.html"> |
| |
| |
| <a href="./wildcard-syntax.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>13.</b> |
| |
| Understanding the Apache ActiveMQ Artemis Wildcard Syntax |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="14" data-path="filter-expressions.html"> |
| |
| |
| <a href="./filter-expressions.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>14.</b> |
| |
| Filter Expressions |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="15" data-path="persistence.html"> |
| |
| |
| <a href="./persistence.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>15.</b> |
| |
| Persistence |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="16" data-path="configuring-transports.html"> |
| |
| |
| <a href="./configuring-transports.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>16.</b> |
| |
| Configuring Transports |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="17" data-path="connection-ttl.html"> |
| |
| |
| <a href="./connection-ttl.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>17.</b> |
| |
| Detecting Dead Connections |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="18" data-path="slow-consumers.html"> |
| |
| |
| <a href="./slow-consumers.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>18.</b> |
| |
| Detecting Slow Consumers |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="19" data-path="transaction-config.html"> |
| |
| |
| <a href="./transaction-config.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>19.</b> |
| |
| Resource Manager Configuration |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="20" data-path="flow-control.html"> |
| |
| |
| <a href="./flow-control.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>20.</b> |
| |
| Flow Control |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="21" data-path="send-guarantees.html"> |
| |
| |
| <a href="./send-guarantees.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>21.</b> |
| |
| Guarantees of sends and commits |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="22" data-path="undelivered-messages.html"> |
| |
| |
| <a href="./undelivered-messages.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>22.</b> |
| |
| Message Redelivery and Undelivered Messages |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="23" data-path="message-expiry.html"> |
| |
| |
| <a href="./message-expiry.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>23.</b> |
| |
| Message Expiry |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="24" data-path="large-messages.html"> |
| |
| |
| <a href="./large-messages.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>24.</b> |
| |
| Large Messages |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="25" data-path="paging.html"> |
| |
| |
| <a href="./paging.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>25.</b> |
| |
| Paging |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="26" data-path="queue-attributes.html"> |
| |
| |
| <a href="./queue-attributes.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>26.</b> |
| |
| Queue Attributes |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="27" data-path="scheduled-messages.html"> |
| |
| |
| <a href="./scheduled-messages.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>27.</b> |
| |
| Scheduled Messages |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="28" data-path="last-value-queues.html"> |
| |
| |
| <a href="./last-value-queues.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>28.</b> |
| |
| Last-Value Queues |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="29" data-path="message-grouping.html"> |
| |
| |
| <a href="./message-grouping.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>29.</b> |
| |
| Message Grouping |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="30" data-path="pre-acknowledge.html"> |
| |
| |
| <a href="./pre-acknowledge.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>30.</b> |
| |
| Extra Acknowledge Modes |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter active" data-level="31" data-path="management.html"> |
| |
| |
| <a href="./management.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>31.</b> |
| |
| Management |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="32" data-path="security.html"> |
| |
| |
| <a href="./security.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>32.</b> |
| |
| Security |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="33" data-path="resource-limits.html"> |
| |
| |
| <a href="./resource-limits.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>33.</b> |
| |
| Resource Limits |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="34" data-path="jms-bridge.html"> |
| |
| |
| <a href="./jms-bridge.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>34.</b> |
| |
| The JMS Bridge |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="35" data-path="client-reconnection.html"> |
| |
| |
| <a href="./client-reconnection.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>35.</b> |
| |
| Client Reconnection and Session Reattachment |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="36" data-path="diverts.html"> |
| |
| |
| <a href="./diverts.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>36.</b> |
| |
| Diverting and Splitting Message Flows |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="37" data-path="core-bridges.html"> |
| |
| |
| <a href="./core-bridges.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>37.</b> |
| |
| Core Bridges |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="38" data-path="duplicate-detection.html"> |
| |
| |
| <a href="./duplicate-detection.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>38.</b> |
| |
| Duplicate Message Detection |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="39" data-path="clusters.html"> |
| |
| |
| <a href="./clusters.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>39.</b> |
| |
| Clusters |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="40" data-path="ha.html"> |
| |
| |
| <a href="./ha.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>40.</b> |
| |
| High Availability and Failover |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="41" data-path="graceful-shutdown.html"> |
| |
| |
| <a href="./graceful-shutdown.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>41.</b> |
| |
| Graceful Server Shutdown |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="42" data-path="libaio.html"> |
| |
| |
| <a href="./libaio.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>42.</b> |
| |
| Libaio Native Libraries |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="43" data-path="thread-pooling.html"> |
| |
| |
| <a href="./thread-pooling.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>43.</b> |
| |
| Thread management |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="44" data-path="logging.html"> |
| |
| |
| <a href="./logging.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>44.</b> |
| |
| Logging |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="45" data-path="rest.html"> |
| |
| |
| <a href="./rest.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>45.</b> |
| |
| REST Interface |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="46" data-path="embedding-activemq.html"> |
| |
| |
| <a href="./embedding-activemq.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>46.</b> |
| |
| Embedding Apache ActiveMQ Artemis |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="47" data-path="karaf.html"> |
| |
| |
| <a href="./karaf.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>47.</b> |
| |
| Apache Karaf |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="48" data-path="spring-integration.html"> |
| |
| |
| <a href="./spring-integration.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>48.</b> |
| |
| Spring Integration |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="49" data-path="aerogear-integration.html"> |
| |
| |
| <a href="./aerogear-integration.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>49.</b> |
| |
| AeroGear Integration |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="50" data-path="vertx-integration.html"> |
| |
| |
| <a href="./vertx-integration.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>50.</b> |
| |
| VertX Integration |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="51" data-path="intercepting-operations.html"> |
| |
| |
| <a href="./intercepting-operations.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>51.</b> |
| |
| Intercepting Operations |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="52" data-path="protocols-interoperability.html"> |
| |
| |
| <a href="./protocols-interoperability.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>52.</b> |
| |
| Protocols and Interoperability |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="53" data-path="tools.html"> |
| |
| |
| <a href="./tools.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>53.</b> |
| |
| Tools |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="54" data-path="maven-plugin.html"> |
| |
| |
| <a href="./maven-plugin.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>54.</b> |
| |
| Maven Plugin |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="55" data-path="perf-tuning.html"> |
| |
| |
| <a href="./perf-tuning.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>55.</b> |
| |
| Troubleshooting and Performance Tuning |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="56" data-path="configuration-index.html"> |
| |
| |
| <a href="./configuration-index.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>56.</b> |
| |
| Configuration Reference |
| </a> |
| |
| |
| |
| </li> |
| |
| |
| |
| |
| <li class="divider"></li> |
| <li> |
| <a href="https://www.gitbook.com" target="blank" class="gitbook-link"> |
| Published with GitBook |
| </a> |
| </li> |
| |
| </ul> |
| </div> |
| |
| <div class="book-body"> |
| <div class="body-inner"> |
| <div class="book-header"> |
| <!-- Actions Left --> |
| <a href="#" class="btn pull-left toggle-summary" aria-label="Table of Contents"><i class="fa fa-align-justify"></i></a> |
| <a href="#" class="btn pull-left toggle-search" aria-label="Search"><i class="fa fa-search"></i></a> |
| |
| <div id="font-settings-wrapper" class="dropdown pull-left"> |
| <a href="#" class="btn toggle-dropdown" aria-label="Font Settings"><i class="fa fa-font"></i> |
| </a> |
| <div class="dropdown-menu font-settings"> |
| <div class="dropdown-caret"> |
| <span class="caret-outer"></span> |
| <span class="caret-inner"></span> |
| </div> |
| |
| <div class="buttons"> |
| <button type="button" id="reduce-font-size" class="button size-2">A</button> |
| <button type="button" id="enlarge-font-size" class="button size-2">A</button> |
| </div> |
| |
| <div class="buttons font-family-list"> |
| <button type="button" data-font="0" class="button">Serif</button> |
| <button type="button" data-font="1" class="button">Sans</button> |
| </div> |
| |
| <div class="buttons color-theme-list"> |
| <button type="button" id="color-theme-preview-0" class="button size-3" data-theme="0">White</button> |
| <button type="button" id="color-theme-preview-1" class="button size-3" data-theme="1">Sepia</button> |
| <button type="button" id="color-theme-preview-2" class="button size-3" data-theme="2">Night</button> |
| </div> |
| </div> |
| |
| </div> |
| |
| <!-- Actions Right --> |
| |
| <div class="dropdown pull-right"> |
| <a href="#" class="btn toggle-dropdown" aria-label="Share"><i class="fa fa-share-alt"></i> |
| </a> |
| <div class="dropdown-menu font-settings dropdown-left"> |
| <div class="dropdown-caret"> |
| <span class="caret-outer"></span> |
| <span class="caret-inner"></span> |
| </div> |
| <div class="buttons"> |
| <button type="button" data-sharing="twitter" class="button"> |
| Share on Twitter |
| </button> |
| <button type="button" data-sharing="google-plus" class="button"> |
| Share on Google |
| </button> |
| <button type="button" data-sharing="facebook" class="button"> |
| Share on Facebook |
| </button> |
| <button type="button" data-sharing="weibo" class="button"> |
| Share on Weibo |
| </button> |
| <button type="button" data-sharing="instapaper" class="button"> |
| Share on Instapaper |
| </button> |
| </div> |
| </div> |
| </div> |
| |
| |
| |
| <a href="#" target="_blank" class="btn pull-right google-plus-sharing-link sharing-link" data-sharing="google-plus" aria-label="Google"><i class="fa fa-google-plus"></i></a> |
| |
| |
| <a href="#" target="_blank" class="btn pull-right facebook-sharing-link sharing-link" data-sharing="facebook" aria-label="Facebook"><i class="fa fa-facebook"></i></a> |
| |
| |
| <a href="#" target="_blank" class="btn pull-right twitter-sharing-link sharing-link" data-sharing="twitter" aria-label="Twitter"><i class="fa fa-twitter"></i></a> |
| |
| |
| |
| |
| |
| <!-- Title --> |
| <h1> |
| <i class="fa fa-circle-o-notch fa-spin"></i> |
| <a href="./" >ActiveMQ Artemis Documentation</a> |
| </h1> |
| </div> |
| |
| <div class="page-wrapper" tabindex="-1"> |
| <div class="page-inner"> |
| |
| |
| <section class="normal" id="section-"> |
| |
| <h1 id="management">Management</h1> |
| <p>Apache ActiveMQ Artemis has an extensive management API that allows a user to modify a |
| server configuration, create new resources (e.g. JMS queues and topics), |
| inspect these resources (e.g. how many messages are currently held in a |
| queue) and interact with it (e.g. to remove messages from a queue). All |
| the operations allows a client to <em>manage</em> Apache ActiveMQ Artemis. It also allows |
| clients to subscribe to management notifications.</p> |
| <p>There are 3 ways to manage Apache ActiveMQ Artemis:</p> |
| <ul> |
| <li><p>Using JMX -- JMX is the standard way to manage Java applications</p> |
| </li> |
| <li><p>Using the core API -- management operations are sent to Apache ActiveMQ Artemis |
| server using <em>core messages</em></p> |
| </li> |
| <li><p>Using the JMS API -- management operations are sent to Apache ActiveMQ Artemis |
| server using <em>JMS messages</em></p> |
| </li> |
| </ul> |
| <p>Although there are 3 different ways to manage Apache ActiveMQ Artemis each API supports |
| the same functionality. If it is possible to manage a resource using JMX |
| it is also possible to achieve the same result using Core messages or |
| JMS messages.</p> |
| <p>This choice depends on your requirements, your application settings and |
| your environment to decide which way suits you best.</p> |
| <h2 id="object-name-changes-between-versions-1-1-and-2">Object name changes between versions 1.1 and 2</h2> |
| <p>In version 1.2 of Artemis new properties were added to distinguish object names when multiple brokers were deploiyed in |
| the same JVM and to be more like ActiveMQ 5. so for the server the name changed from <code>org.apache.activemq.artemis:module=Core,type=Server</code> |
| to <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,ServerType=Server</code>. you can configure |
| the old style by setting <code><jmx-use-broker-name>false</jmx-use-broker-name></code>. Note that if you do not set a broker name |
| then this will default to localhost.</p> |
| <h2 id="the-management-api">The Management API</h2> |
| <p>Regardless of the way you <em>invoke</em> management operations, the management |
| API is the same.</p> |
| <p>For each <em>managed resource</em>, there exists a Java interface describing |
| what can be invoked for this type of resource.</p> |
| <p>Apache ActiveMQ Artemis exposes its managed resources in 2 packages:</p> |
| <ul> |
| <li><p><em>Core</em> resources are located in the |
| <code>org.apache.activemq.artemis.api.core.management</code> package</p> |
| </li> |
| <li><p><em>JMS</em> resources are located in the |
| <code>org.apache.activemq.artemis.api.jms.management</code> package</p> |
| </li> |
| </ul> |
| <p>The way to invoke a <em>management operations</em> depends whether JMX, core |
| messages, or JMS messages are used.</p> |
| <blockquote> |
| <p><strong>Note</strong></p> |
| <p>A few management operations requires a <code>filter</code> parameter to chose |
| which messages are involved by the operation. Passing <code>null</code> or an |
| empty string means that the management operation will be performed on |
| <em>all messages</em>.</p> |
| </blockquote> |
| <h3 id="core-management-api">Core Management API</h3> |
| <p>Apache ActiveMQ Artemis defines a core management API to manage core resources. For |
| full details of the API please consult the javadoc. In summary:</p> |
| <h4 id="core-server-management">Core Server Management</h4> |
| <ul> |
| <li><p>Listing, creating, deploying and destroying queues</p> |
| <p>A list of deployed core queues can be retrieved using the |
| <code>getQueueNames()</code> method.</p> |
| <p>Core queues can be created or destroyed using the management |
| operations <code>createQueue()</code> or <code>deployQueue()</code> or <code>destroyQueue()</code>)on |
| the <code>ActiveMQServerControl</code> (with the ObjectName |
| <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=Server</code> or the resource name |
| <code>core.server</code>)</p> |
| <p><code>createQueue</code> will fail if the queue already exists while |
| <code>deployQueue</code> will do nothing.</p> |
| </li> |
| <li><p>Pausing and resuming Queues</p> |
| <p>The <code>QueueControl</code> can pause and resume the underlying queue. When a |
| queue is paused, it will receive messages but will not deliver them. |
| When it's resumed, it'll begin delivering the queued messages, if |
| any.</p> |
| </li> |
| <li><p>Listing and closing remote connections</p> |
| <p>Client's remote addresses can be retrieved using |
| <code>listRemoteAddresses()</code>. It is also possible to close the |
| connections associated with a remote address using the |
| <code>closeConnectionsForAddress()</code> method.</p> |
| <p>Alternatively, connection IDs can be listed using |
| <code>listConnectionIDs()</code> and all the sessions for a given connection ID |
| can be listed using <code>listSessions()</code>.</p> |
| </li> |
| <li><p>Transaction heuristic operations</p> |
| <p>In case of a server crash, when the server restarts, it it possible |
| that some transaction requires manual intervention. The |
| <code>listPreparedTransactions()</code> method lists the transactions which are |
| in the prepared states (the transactions are represented as opaque |
| Base64 Strings.) To commit or rollback a given prepared transaction, |
| the <code>commitPreparedTransaction()</code> or <code>rollbackPreparedTransaction()</code> |
| method can be used to resolve heuristic transactions. Heuristically |
| completed transactions can be listed using the |
| <code>listHeuristicCommittedTransactions()</code> and |
| <code>listHeuristicRolledBackTransactions</code> methods.</p> |
| </li> |
| <li><p>Enabling and resetting Message counters</p> |
| <p>Message counters can be enabled or disabled using the |
| <code>enableMessageCounters()</code> or <code>disableMessageCounters()</code> method. To |
| reset message counters, it is possible to invoke |
| <code>resetAllMessageCounters()</code> and <code>resetAllMessageCounterHistories()</code> |
| methods.</p> |
| </li> |
| <li><p>Retrieving the server configuration and attributes</p> |
| <p>The <code>ActiveMQServerControl</code> exposes Apache ActiveMQ Artemis server configuration |
| through all its attributes (e.g. <code>getVersion()</code> method to retrieve |
| the server's version, etc.)</p> |
| </li> |
| <li><p>Listing, creating and destroying Core bridges and diverts</p> |
| <p>A list of deployed core bridges (resp. diverts) can be retrieved |
| using the <code>getBridgeNames()</code> (resp. <code>getDivertNames()</code>) method.</p> |
| <p>Core bridges (resp. diverts) can be created or destroyed using the |
| management operations <code>createBridge()</code> and <code>destroyBridge()</code> (resp. |
| <code>createDivert()</code> and <code>destroyDivert()</code>) on the |
| <code>ActiveMQServerControl</code> (with the ObjectName |
| <code>org.apache.activemq.artemis:module=Core,type=Server</code> or the resource name |
| <code>core.server</code>).</p> |
| </li> |
| <li><p>It is possible to stop the server and force failover to occur with |
| any currently attached clients.</p> |
| <p>to do this use the <code>forceFailover()</code> on the <code>ActiveMQServerControl</code> |
| (with the ObjectName <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=Server</code> |
| or the resource name <code>core.server</code>)</p> |
| <blockquote> |
| <p><strong>Note</strong></p> |
| <p>Since this method actually stops the server you will probably |
| receive some sort of error depending on which management service |
| you use to call it.</p> |
| </blockquote> |
| </li> |
| </ul> |
| <h4 id="core-address-management">Core Address Management</h4> |
| <p>Core addresses can be managed using the <code>AddressControl</code> class (with the |
| ObjectName <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=Address,name="<the |
| address name>"</code> or the resource name |
| <code>core.address.<the |
| address name></code>).</p> |
| <ul> |
| <li><p>Modifying roles and permissions for an address</p> |
| <p>You can add or remove roles associated to a queue using the |
| <code>addRole()</code> or <code>removeRole()</code> methods. You can list all the roles |
| associated to the queue with the <code>getRoles()</code> method</p> |
| </li> |
| </ul> |
| <h4 id="core-queue-management">Core Queue Management</h4> |
| <p>The bulk of the core management API deals with core queues. The |
| <code>QueueControl</code> class defines the Core queue management operations (with |
| the ObjectName |
| <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=Queue,address="<the bound |
| address>",name="<the queue name>"</code> or the resource |
| name <code>core.queue.<the queue name></code>).</p> |
| <p>Most of the management operations on queues take either a single message |
| ID (e.g. to remove a single message) or a filter (e.g. to expire all |
| messages with a given property.)</p> |
| <ul> |
| <li><p>Expiring, sending to a dead letter address and moving messages</p> |
| <p>Messages can be expired from a queue by using the <code>expireMessages()</code> |
| method. If an expiry address is defined, messages will be sent to |
| it, otherwise they are discarded. The queue's expiry address can be |
| set with the <code>setExpiryAddress()</code> method.</p> |
| <p>Messages can also be sent to a dead letter address with the |
| <code>sendMessagesToDeadLetterAddress()</code> method. It returns the number of |
| messages which are sent to the dead letter address. If a dead letter |
| address is not defined, message are removed from the queue and |
| discarded. The queue's dead letter address can be set with the |
| <code>setDeadLetterAddress()</code> method.</p> |
| <p>Messages can also be moved from a queue to another queue by using |
| the <code>moveMessages()</code> method.</p> |
| </li> |
| <li><p>Listing and removing messages</p> |
| <p>Messages can be listed from a queue by using the <code>listMessages()</code> |
| method which returns an array of <code>Map</code>, one <code>Map</code> for each message.</p> |
| <p>Messages can also be removed from the queue by using the |
| <code>removeMessages()</code> method which returns a <code>boolean</code> for the single |
| message ID variant or the number of removed messages for the filter |
| variant. The <code>removeMessages()</code> method takes a <code>filter</code> argument to |
| remove only filtered messages. Setting the filter to an empty string |
| will in effect remove all messages.</p> |
| </li> |
| <li><p>Counting messages</p> |
| <p>The number of messages in a queue is returned by the |
| <code>getMessageCount()</code> method. Alternatively, the <code>countMessages()</code> |
| will return the number of messages in the queue which <em>match a given |
| filter</em></p> |
| </li> |
| <li><p>Changing message priority</p> |
| <p>The message priority can be changed by using the |
| <code>changeMessagesPriority()</code> method which returns a <code>boolean</code> for the |
| single message ID variant or the number of updated messages for the |
| filter variant.</p> |
| </li> |
| <li><p>Message counters</p> |
| <p>Message counters can be listed for a queue with the |
| <code>listMessageCounter()</code> and <code>listMessageCounterHistory()</code> methods |
| (see Message Counters section). The message counters can also be |
| reset for a single queue using the <code>resetMessageCounter()</code> method.</p> |
| </li> |
| <li><p>Retrieving the queue attributes</p> |
| <p>The <code>QueueControl</code> exposes Core queue settings through its |
| attributes (e.g. <code>getFilter()</code> to retrieve the queue's filter if it |
| was created with one, <code>isDurable()</code> to know whether the queue is |
| durable or not, etc.)</p> |
| </li> |
| <li><p>Pausing and resuming Queues</p> |
| <p>The <code>QueueControl</code> can pause and resume the underlying queue. When a |
| queue is paused, it will receive messages but will not deliver them. |
| When it's resume, it'll begin delivering the queued messages, if |
| any.</p> |
| </li> |
| </ul> |
| <h4 id="other-core-resources-management">Other Core Resources Management</h4> |
| <p>Apache ActiveMQ Artemis allows to start and stop its remote resources (acceptors, |
| diverts, bridges, etc.) so that a server can be taken off line for a |
| given period of time without stopping it completely (e.g. if other |
| management operations must be performed such as resolving heuristic |
| transactions). These resources are:</p> |
| <ul> |
| <li><p>Acceptors</p> |
| <p>They can be started or stopped using the <code>start()</code> or. <code>stop()</code> |
| method on the <code>AcceptorControl</code> class (with the ObjectName |
| <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=Acceptor,name="<the acceptor name>"</code> |
| or the resource name |
| <code>core.acceptor.<the address name></code>). The acceptors parameters |
| can be retrieved using the <code>AcceptorControl</code> attributes (see <a href="configuring-transports.html">Understanding Acceptors</a>)</p> |
| </li> |
| <li><p>Diverts</p> |
| <p>They can be started or stopped using the <code>start()</code> or <code>stop()</code> |
| method on the <code>DivertControl</code> class (with the ObjectName |
| <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=Divert,name=<the divert name></code> |
| or the resource name <code>core.divert.<the divert name></code>). Diverts |
| parameters can be retrieved using the <code>DivertControl</code> attributes |
| (see <a href="diverts.html">Diverting and Splitting Message Flows)</a>)</p> |
| </li> |
| <li><p>Bridges</p> |
| <p>They can be started or stopped using the <code>start()</code> (resp. <code>stop()</code>) |
| method on the <code>BridgeControl</code> class (with the ObjectName |
| <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=Bridge,name="<the bridge name>"</code> |
| or the resource name |
| <code>core.bridge.<the bridge name></code>). Bridges parameters can be retrieved |
| using the <code>BridgeControl</code> attributes (see <a href="core-bridges.html">Core bridges</a>)</p> |
| </li> |
| <li><p>Broadcast groups</p> |
| <p>They can be started or stopped using the <code>start()</code> or <code>stop()</code> |
| method on the <code>BroadcastGroupControl</code> class (with the ObjectName |
| <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=BroadcastGroup,name="<the broadcast group name>"</code> or the resource name |
| <code>core.broadcastgroup.<the broadcast group name></code>). Broadcast groups |
| parameters can be retrieved using the <code>BroadcastGroupControl</code> |
| attributes (see <a href="clusters.html">Clusters</a>)</p> |
| </li> |
| <li><p>Discovery groups</p> |
| <p>They can be started or stopped using the <code>start()</code> or <code>stop()</code> |
| method on the <code>DiscoveryGroupControl</code> class (with the ObjectName |
| <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=DiscoveryGroup,name="<the discovery group name>"</code> or the resource name |
| <code>core.discovery.<the discovery group name></code>). Discovery groups |
| parameters can be retrieved using the <code>DiscoveryGroupControl</code> |
| attributes (see <a href="clusters.html">Clusters</a>)</p> |
| </li> |
| <li><p>Cluster connections</p> |
| <p>They can be started or stopped using the <code>start()</code> or <code>stop()</code> |
| method on the <code>ClusterConnectionControl</code> class (with the ObjectName |
| <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=ClusterConnection,name="<the cluster connection name>"</code> or the resource name |
| <code>core.clusterconnection.<the cluster connection name></code>). Cluster |
| connections parameters can be retrieved using the |
| <code>ClusterConnectionControl</code> attributes (see <a href="clusters.html">Clusters</a>)</p> |
| </li> |
| </ul> |
| <h3 id="jms-management-api">JMS Management API</h3> |
| <p>Apache ActiveMQ Artemis defines a JMS Management API to manage JMS <em>administrated |
| objects</em> (i.e. JMS queues, topics and connection factories).</p> |
| <h4 id="jms-server-management">JMS Server Management</h4> |
| <p>JMS Resources (connection factories and destinations) can be created |
| using the <code>JMSServerControl</code> class (with the ObjectName |
| <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=JMS,serviceType=Server</code> or the resource name |
| <code>jms.server</code>).</p> |
| <ul> |
| <li><p>Listing, creating, destroying connection factories</p> |
| <p>Names of the deployed connection factories can be retrieved by the |
| <code>getConnectionFactoryNames()</code> method.</p> |
| <p>JMS connection factories can be created or destroyed using the |
| <code>createConnectionFactory()</code> methods or <code>destroyConnectionFactory()</code> |
| methods. These connection factories are bound to JNDI so that JMS |
| clients can look them up. If a graphical console is used to create |
| the connection factories, the transport parameters are specified in |
| the text field input as a comma-separated list of key=value (e.g. |
| <code>key1=10, key2="value", key3=false</code>). If there are multiple |
| transports defined, you need to enclose the key/value pairs between |
| curly braces. For example <code>{key=10}, {key=20}</code>. In that case, the |
| first <code>key</code> will be associated to the first transport configuration |
| and the second <code>key</code> will be associated to the second transport |
| configuration (see <a href="configuring-transports.html">Configuring Transports</a> |
| for a list of the transport parameters)</p> |
| </li> |
| <li><p>Listing, creating, destroying queues</p> |
| <p>Names of the deployed JMS queues can be retrieved by the |
| <code>getQueueNames()</code> method.</p> |
| <p>JMS queues can be created or destroyed using the <code>createQueue()</code> |
| methods or <code>destroyQueue()</code> methods. These queues are bound to JNDI |
| so that JMS clients can look them up</p> |
| </li> |
| <li><p>Listing, creating/destroying topics</p> |
| <p>Names of the deployed topics can be retrieved by the |
| <code>getTopicNames()</code> method.</p> |
| <p>JMS topics can be created or destroyed using the <code>createTopic()</code> or |
| <code>destroyTopic()</code> methods. These topics are bound to JNDI so that JMS |
| clients can look them up</p> |
| </li> |
| <li><p>Listing and closing remote connections</p> |
| <p>JMS Clients remote addresses can be retrieved using |
| <code>listRemoteAddresses()</code>. It is also possible to close the |
| connections associated with a remote address using the |
| <code>closeConnectionsForAddress()</code> method.</p> |
| <p>Alternatively, connection IDs can be listed using |
| <code>listConnectionIDs()</code> and all the sessions for a given connection ID |
| can be listed using <code>listSessions()</code>.</p> |
| </li> |
| </ul> |
| <h4 id="jms-connectionfactory-management">JMS ConnectionFactory Management</h4> |
| <p>JMS Connection Factories can be managed using the |
| <code>ConnectionFactoryControl</code> class (with the ObjectName |
| <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=JMS,serviceType=ConnectionFactory,name="<the connection factory |
| name>"</code> or the resource name |
| <code>jms.connectionfactory.<the |
| connection factory name></code>).</p> |
| <ul> |
| <li><p>Retrieving connection factory attributes</p> |
| <p>The <code>ConnectionFactoryControl</code> exposes JMS ConnectionFactory |
| configuration through its attributes (e.g. <code>getConsumerWindowSize()</code> |
| to retrieve the consumer window size for flow control, |
| <code>isBlockOnNonDurableSend()</code> to know whether the producers created |
| from the connection factory will block or not when sending |
| non-durable messages, etc.)</p> |
| </li> |
| </ul> |
| <h4 id="jms-queue-management">JMS Queue Management</h4> |
| <p>JMS queues can be managed using the <code>JMSQueueControl</code> class (with the |
| ObjectName <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=JMS,serviceType=Queue,name="<the queue |
| name>"</code> or the resource name <code>jms.queue.<the queue |
| name></code>).</p> |
| <p><em>The management operations on a JMS queue are very similar to the |
| operations on a core queue.</em></p> |
| <ul> |
| <li><p>Expiring, sending to a dead letter address and moving messages</p> |
| <p>Messages can be expired from a queue by using the <code>expireMessages()</code> |
| method. If an expiry address is defined, messages will be sent to |
| it, otherwise they are discarded. The queue's expiry address can be |
| set with the <code>setExpiryAddress()</code> method.</p> |
| <p>Messages can also be sent to a dead letter address with the |
| <code>sendMessagesToDeadLetterAddress()</code> method. It returns the number of |
| messages which are sent to the dead letter address. If a dead letter |
| address is not defined, message are removed from the queue and |
| discarded. The queue's dead letter address can be set with the |
| <code>setDeadLetterAddress()</code> method.</p> |
| <p>Messages can also be moved from a queue to another queue by using |
| the <code>moveMessages()</code> method.</p> |
| </li> |
| <li><p>Listing and removing messages</p> |
| <p>Messages can be listed from a queue by using the <code>listMessages()</code> |
| method which returns an array of <code>Map</code>, one <code>Map</code> for each message.</p> |
| <p>Messages can also be removed from the queue by using the |
| <code>removeMessages()</code> method which returns a <code>boolean</code> for the single |
| message ID variant or the number of removed messages for the filter |
| variant. The <code>removeMessages()</code> method takes a <code>filter</code> argument to |
| remove only filtered messages. Setting the filter to an empty string |
| will in effect remove all messages.</p> |
| </li> |
| <li><p>Counting messages</p> |
| <p>The number of messages in a queue is returned by the |
| <code>getMessageCount()</code> method. Alternatively, the <code>countMessages()</code> |
| will return the number of messages in the queue which <em>match a given |
| filter</em></p> |
| </li> |
| <li><p>Changing message priority</p> |
| <p>The message priority can be changed by using the |
| <code>changeMessagesPriority()</code> method which returns a <code>boolean</code> for the |
| single message ID variant or the number of updated messages for the |
| filter variant.</p> |
| </li> |
| <li><p>Message counters</p> |
| <p>Message counters can be listed for a queue with the |
| <code>listMessageCounter()</code> and <code>listMessageCounterHistory()</code> methods |
| (see Message Counters section)</p> |
| </li> |
| <li><p>Retrieving the queue attributes</p> |
| <p>The <code>JMSQueueControl</code> exposes JMS queue settings through its |
| attributes (e.g. <code>isTemporary()</code> to know whether the queue is |
| temporary or not, <code>isDurable()</code> to know whether the queue is durable |
| or not, etc.)</p> |
| </li> |
| <li><p>Pausing and resuming queues</p> |
| <p>The <code>JMSQueueControl</code> can pause and resume the underlying queue. |
| When the queue is paused it will continue to receive messages but |
| will not deliver them. When resumed again it will deliver the |
| enqueued messages, if any.</p> |
| </li> |
| </ul> |
| <h4 id="jms-topic-management">JMS Topic Management</h4> |
| <p>JMS Topics can be managed using the <code>TopicControl</code> class (with the |
| ObjectName <code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=JMS,serviceType=Topic,name="<the topic |
| name>"</code> or the resource name <code>jms.topic.<the topic |
| name></code>).</p> |
| <ul> |
| <li><p>Listing subscriptions and messages</p> |
| <p>JMS topics subscriptions can be listed using the |
| <code>listAllSubscriptions()</code>, <code>listDurableSubscriptions()</code>, |
| <code>listNonDurableSubscriptions()</code> methods. These methods return arrays |
| of <code>Object</code> representing the subscriptions information (subscription |
| name, client ID, durability, message count, etc.). It is also |
| possible to list the JMS messages for a given subscription with the |
| <code>listMessagesForSubscription()</code> method.</p> |
| </li> |
| <li><p>Dropping subscriptions</p> |
| <p>Durable subscriptions can be dropped from the topic using the |
| <code>dropDurableSubscription()</code> method.</p> |
| </li> |
| <li><p>Counting subscriptions messages</p> |
| <p>The <code>countMessagesForSubscription()</code> method can be used to know the |
| number of messages held for a given subscription (with an optional |
| message selector to know the number of messages matching the |
| selector)</p> |
| </li> |
| </ul> |
| <h2 id="using-management-via-jmx">Using Management Via JMX</h2> |
| <p>Apache ActiveMQ Artemis can be managed using |
| <a href="http://www.oracle.com/technetwork/java/javase/tech/javamanagement-140525.html" target="_blank">JMX</a>.</p> |
| <p>The management API is exposed by Apache ActiveMQ Artemis using MBeans interfaces. |
| Apache ActiveMQ Artemis registers its resources with the domain <code>org.apache.activemq</code>.</p> |
| <p>For example, the <code>ObjectName</code> to manage a JMS Queue <code>exampleQueue</code> is:</p> |
| <pre><code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=JMS,serviceType=Queue,name="exampleQueue" |
| </code></pre><p>and the MBean is:</p> |
| <pre><code>org.apache.activemq.artemis.api.jms.management.JMSQueueControl |
| </code></pre><p>The MBean's <code>ObjectName</code> are built using the helper class |
| <code>org.apache.activemq.artemis.api.core.management.ObjectNameBuilder</code>. You can |
| also use <code>jconsole</code> to find the <code>ObjectName</code> of the MBeans you want to |
| manage.</p> |
| <p>Managing Apache ActiveMQ Artemis using JMX is identical to management of any Java |
| Applications using JMX. It can be done by reflection or by creating |
| proxies of the MBeans.</p> |
| <h3 id="configuring-jmx">Configuring JMX</h3> |
| <p>By default, JMX is enabled to manage Apache ActiveMQ Artemis. It can be disabled by |
| setting <code>jmx-management-enabled</code> to <code>false</code> in |
| <code>broker.xml</code>:</p> |
| <pre><code><!-- false to disable JMX management for Apache ActiveMQ Artemis --> |
| <jmx-management-enabled>false</jmx-management-enabled> |
| </code></pre><p>If JMX is enabled, Apache ActiveMQ Artemis can be managed locally using <code>jconsole</code>.</p> |
| <blockquote> |
| <p><strong>Note</strong></p> |
| <p>Remote connections to JMX are not enabled by default for security |
| reasons. Please refer to <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/management/agent.html" target="_blank">Java Management |
| guide</a> |
| to configure the server for remote management (system properties must |
| be set in <code>run.sh</code> or <code>run.bat</code> scripts).</p> |
| </blockquote> |
| <p>By default, Apache ActiveMQ Artemis server uses the JMX domain "org.apache.activemq.artemis". |
| To manage several Apache ActiveMQ Artemis servers from the <em>same</em> MBeanServer, the JMX |
| domain can be configured for each individual Apache ActiveMQ Artemis server by setting |
| <code>jmx-domain</code> in <code>broker.xml</code>:</p> |
| <pre><code><!-- use a specific JMX domain for ActiveMQ Artemis MBeans --> |
| <jmx-domain>my.org.apache.activemq</jmx-domain> |
| </code></pre><h4 id="mbeanserver-configuration">MBeanServer configuration</h4> |
| <p>When Apache ActiveMQ Artemis is run in standalone, it uses the Java Virtual Machine's |
| <code>Platform MBeanServer</code> to register its MBeans. By default <a href="http://www.jolokia.org/" target="_blank">Jolokia</a> |
| is also deployed to allow access to the mbean server via rest.</p> |
| <h3 id="example">Example</h3> |
| <p>See the <a href="examples.html">chapters</a> chapter for an example which shows how to use a remote connection to JMX |
| and MBean proxies to manage Apache ActiveMQ Artemis.</p> |
| <h3 id="exposing-jmx-using-jolokia">Exposing JMX using Jolokia</h3> |
| <p>The default Broker configuration ships with the <a href="http://www.jolokia.org" target="_blank">Jolokia</a> |
| http agent deployed as a Web Application. Jolokia is a remote |
| JMX over HTTP bridge that exposed mBeans, for a full guids as |
| to how to use refer to <a href="http://www.jolokia.org/documentation.html" target="_blank">Jolokia Documentation</a>, |
| however a simple example to query thebrokers version would |
| be to use a brower and go to the URL <a href="http://localhost:8161/jolokia/read/org.apache.activemq.artemis:module=Core,type=Server/Version" target="_blank">http://localhost:8161/jolokia/read/org.apache.activemq.artemis:module=Core,type=Server/Version</a>.</p> |
| <p>This would give you back something like the following:</p> |
| <pre><code>{"timestamp":1422019706,"status":200,"request":{"mbean":"org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=Server","attribute":"Version","type":"read"},"value":"1.0.0.SNAPSHOT (Active Hornet, 126)"} |
| </code></pre><h2 id="using-management-via-core-api">Using Management Via Core API</h2> |
| <p>The core management API in ActiveMQ Artemis is called by sending Core messages |
| to a special address, the <em>management address</em>.</p> |
| <p><em>Management messages</em> are regular Core messages with well-known |
| properties that the server needs to understand to interact with the |
| management API:</p> |
| <ul> |
| <li><p>The name of the managed resource</p> |
| </li> |
| <li><p>The name of the management operation</p> |
| </li> |
| <li><p>The parameters of the management operation</p> |
| </li> |
| </ul> |
| <p>When such a management message is sent to the management address, |
| Apache ActiveMQ Artemis server will handle it, extract the information, invoke the |
| operation on the managed resources and send a <em>management reply</em> to the |
| management message's reply-to address (specified by |
| <code>ClientMessageImpl.REPLYTO_HEADER_NAME</code>).</p> |
| <p>A <code>ClientConsumer</code> can be used to consume the management reply and |
| retrieve the result of the operation (if any) stored in the reply's |
| body. For portability, results are returned as a <a href="http://json.org" target="_blank">JSON</a> |
| String rather than Java Serialization (the |
| <code>org.apache.activemq.artemis.api.core.management.ManagementHelper</code> can be used |
| to convert the JSON string to Java objects).</p> |
| <p>These steps can be simplified to make it easier to invoke management |
| operations using Core messages:</p> |
| <ol> |
| <li><p>Create a <code>ClientRequestor</code> to send messages to the management |
| address and receive replies</p> |
| </li> |
| <li><p>Create a <code>ClientMessage</code></p> |
| </li> |
| <li><p>Use the helper class |
| <code>org.apache.activemq.artemis.api.core.management.ManagementHelper</code> to fill |
| the message with the management properties</p> |
| </li> |
| <li><p>Send the message using the <code>ClientRequestor</code></p> |
| </li> |
| <li><p>Use the helper class |
| <code>org.apache.activemq.artemis.api.core.management.ManagementHelper</code> to |
| retrieve the operation result from the management reply</p> |
| </li> |
| </ol> |
| <p>For example, to find out the number of messages in the core queue |
| <code>exampleQueue</code>:</p> |
| <pre><code class="lang-java">ClientSession session = ... |
| ClientRequestor requestor = <span class="hljs-keyword">new</span> ClientRequestor(session, <span class="hljs-string">"jms.queue.activemq.management"</span>); |
| ClientMessage message = session.createMessage(<span class="hljs-keyword">false</span>); |
| ManagementHelper.putAttribute(message, <span class="hljs-string">"core.queue.exampleQueue"</span>, <span class="hljs-string">"messageCount"</span>); |
| session.start(); |
| ClientMessage reply = requestor.request(m); |
| <span class="hljs-keyword">int</span> count = (Integer) ManagementHelper.getResult(reply); |
| System.out.println(<span class="hljs-string">"There are "</span> + count + <span class="hljs-string">" messages in exampleQueue"</span>); |
| </code></pre> |
| <p>Management operation name and parameters must conform to the Java |
| interfaces defined in the <code>management</code> packages.</p> |
| <p>Names of the resources are built using the helper class |
| <code>org.apache.activemq.artemis.api.core.management.ResourceNames</code> and are |
| straightforward (<code>core.queue.exampleQueue</code> for the Core Queue |
| <code>exampleQueue</code>, <code>jms.topic.exampleTopic</code> for the JMS Topic |
| <code>exampleTopic</code>, etc.).</p> |
| <h3 id="configuring-core-management">Configuring Core Management</h3> |
| <p>The management address to send management messages is configured in |
| <code>broker.xml</code>:</p> |
| <pre><code><management-address>jms.queue.activemq.management</management-address> |
| </code></pre><p>By default, the address is <code>jms.queue.activemq.management</code> (it is |
| prepended by "jms.queue" so that JMS clients can also send management |
| messages).</p> |
| <p>The management address requires a <em>special</em> user permission <code>manage</code> to |
| be able to receive and handle management messages. This is also |
| configured in broker.xml:</p> |
| <pre><code><!-- users with the admin role will be allowed to manage --> |
| <!-- Apache ActiveMQ Artemis using management messages --> |
| <security-setting match="jms.queue.activemq.management"> |
| <permission type="manage" roles="admin" /> |
| </security-setting> |
| </code></pre><h2 id="using-management-via-jms">Using Management Via JMS</h2> |
| <p>Using JMS messages to manage ActiveMQ Artemis is very similar to using core API.</p> |
| <p>An important difference is that JMS requires a JMS queue to send the |
| messages to (instead of an address for the core API).</p> |
| <p>The <em>management queue</em> is a special queue and needs to be instantiated |
| directly by the client:</p> |
| <pre><code>Queue managementQueue = ActiveMQJMSClient.createQueue("activemq.management"); |
| </code></pre><p>All the other steps are the same than for the Core API but they use JMS |
| API instead:</p> |
| <ol> |
| <li><p>create a <code>QueueRequestor</code> to send messages to the management address |
| and receive replies</p> |
| </li> |
| <li><p>create a <code>Message</code></p> |
| </li> |
| <li><p>use the helper class |
| <code>org.apache.activemq.artemis.api.jms.management.JMSManagementHelper</code> to fill |
| the message with the management properties</p> |
| </li> |
| <li><p>send the message using the <code>QueueRequestor</code></p> |
| </li> |
| <li><p>use the helper class |
| <code>org.apache.activemq.artemis.api.jms.management.JMSManagementHelper</code> to |
| retrieve the operation result from the management reply</p> |
| </li> |
| </ol> |
| <p>For example, to know the number of messages in the JMS queue |
| <code>exampleQueue</code>:</p> |
| <pre><code class="lang-java">Queue managementQueue = ActiveMQJMSClient.createQueue(<span class="hljs-string">"activemq.management"</span>); |
| |
| QueueSession session = ... |
| QueueRequestor requestor = <span class="hljs-keyword">new</span> QueueRequestor(session, managementQueue); |
| connection.start(); |
| Message message = session.createMessage(); |
| JMSManagementHelper.putAttribute(message, <span class="hljs-string">"jms.queue.exampleQueue"</span>, <span class="hljs-string">"messageCount"</span>); |
| Message reply = requestor.request(message); |
| <span class="hljs-keyword">int</span> count = (Integer)JMSManagementHelper.getResult(reply); |
| System.out.println(<span class="hljs-string">"There are "</span> + count + <span class="hljs-string">" messages in exampleQueue"</span>); |
| </code></pre> |
| <h3 id="configuring-jms-management">Configuring JMS Management</h3> |
| <p>Whether JMS or the core API is used for management, the configuration |
| steps are the same (see Configuring Core Management section).</p> |
| <h3 id="example">Example</h3> |
| <p>See the <a href="examples.html">examples</a> chapter for an example which shows |
| how to use JMS messages to manage the Apache ActiveMQ Artemis server.</p> |
| <h2 id="management-notifications">Management Notifications</h2> |
| <p>Apache ActiveMQ Artemis emits <em>notifications</em> to inform listeners of potentially |
| interesting events (creation of new resources, security violation, |
| etc.).</p> |
| <p>These notifications can be received by 3 different ways:</p> |
| <ul> |
| <li><p>JMX notifications</p> |
| </li> |
| <li><p>Core messages</p> |
| </li> |
| <li><p>JMS messages</p> |
| </li> |
| </ul> |
| <h3 id="jmx-notifications">JMX Notifications</h3> |
| <p>If JMX is enabled (see Configuring JMX section), JMX notifications can be received by |
| subscribing to 2 MBeans:</p> |
| <ul> |
| <li><p><code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=Core,serviceType=Server</code> for notifications on |
| <em>Core</em> resources</p> |
| </li> |
| <li><p><code>org.apache.activemq.artemis:type=Broker,brokerName=<broker name>,module=JMS,serviceType=Server</code> for notifications on |
| <em>JMS</em> resources</p> |
| </li> |
| </ul> |
| <h3 id="core-messages-notifications">Core Messages Notifications</h3> |
| <p>Apache ActiveMQ Artemis defines a special <em>management notification address</em>. Core |
| queues can be bound to this address so that clients will receive |
| management notifications as Core messages</p> |
| <p>A Core client which wants to receive management notifications must |
| create a core queue bound to the management notification address. It can |
| then receive the notifications from its queue.</p> |
| <p>Notifications messages are regular core messages with additional |
| properties corresponding to the notification (its type, when it |
| occurred, the resources which were concerned, etc.).</p> |
| <p>Since notifications are regular core messages, it is possible to use |
| message selectors to filter out notifications and receives only a subset |
| of all the notifications emitted by the server.</p> |
| <h4 id="configuring-the-core-management-notification-address">Configuring The Core Management Notification Address</h4> |
| <p>The management notification address to receive management notifications |
| is configured in <code>broker.xml</code>:</p> |
| <pre><code><management-notification-address>activemq.notifications</management-notification-address> |
| </code></pre><p>By default, the address is <code>activemq.notifications</code>.</p> |
| <h3 id="jms-messages-notifications">JMS Messages Notifications</h3> |
| <p>Apache ActiveMQ Artemis's notifications can also be received using JMS messages.</p> |
| <p>It is similar to receiving notifications using Core API but an important |
| difference is that JMS requires a JMS Destination to receive the |
| messages (preferably a Topic).</p> |
| <p>To use a JMS Destination to receive management notifications, you must |
| change the server's management notification address to start with |
| <code>jms.queue</code> if it is a JMS Queue or <code>jms.topic</code> if it is a JMS Topic:</p> |
| <pre><code><!-- notifications will be consumed from "notificationsTopic" JMS Topic --> |
| <management-notification-address>jms.topic.notificationsTopic</management-notification-address> |
| </code></pre><p>Once the notification topic is created, you can receive messages from it |
| or set a <code>MessageListener</code>:</p> |
| <pre><code class="lang-java">Topic notificationsTopic = ActiveMQJMSClient.createTopic(<span class="hljs-string">"notificationsTopic"</span>); |
| |
| Session session = ... |
| MessageConsumer notificationConsumer = session.createConsumer(notificationsTopic); |
| notificationConsumer.setMessageListener(<span class="hljs-keyword">new</span> MessageListener() |
| { |
| <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">onMessage</span><span class="hljs-params">(Message notif)</span> |
| </span>{ |
| System.out.println(<span class="hljs-string">"------------------------"</span>); |
| System.out.println(<span class="hljs-string">"Received notification:"</span>); |
| <span class="hljs-keyword">try</span> |
| { |
| Enumeration propertyNames = notif.getPropertyNames(); |
| <span class="hljs-keyword">while</span> (propertyNames.hasMoreElements()) |
| { |
| String propertyName = (String)propertyNames.nextElement(); |
| System.out.format(<span class="hljs-string">" %s: %s\n"</span>, propertyName, notif.getObjectProperty(propertyName)); |
| } |
| } |
| <span class="hljs-keyword">catch</span> (JMSException e) |
| { |
| } |
| System.out.println(<span class="hljs-string">"------------------------"</span>); |
| } |
| }); |
| </code></pre> |
| <h3 id="example">Example</h3> |
| <p>See the <a href="examples.html">examples</a> chapter for an example which shows how to use a JMS <code>MessageListener</code> to receive management notifications from ActiveMQ Artemis server.</p> |
| <h3 id="notification-types-and-headers">Notification Types and Headers</h3> |
| <p>Below is a list of all the different kinds of notifications as well as |
| which headers are on the messages. Every notification has a |
| <code>_AMQ_NotifType</code> (value noted in parentheses) and <code>_AMQ_NotifTimestamp</code> |
| header. The timestamp is the un-formatted result of a call to |
| <code>java.lang.System.currentTimeMillis()</code>.</p> |
| <ul> |
| <li><p><code>BINDING_ADDED</code> (0)</p> |
| <p><code>_AMQ_Binding_Type</code>, <code>_AMQ_Address</code>, <code>_AMQ_ClusterName</code>, |
| <code>_AMQ_RoutingName</code>, <code>_AMQ_Binding_ID</code>, <code>_AMQ_Distance</code>, |
| <code>_AMQ_FilterString</code></p> |
| </li> |
| <li><p><code>BINDING_REMOVED</code> (1)</p> |
| <p><code>_AMQ_Address</code>, <code>_AMQ_ClusterName</code>, <code>_AMQ_RoutingName</code>, |
| <code>_AMQ_Binding_ID</code>, <code>_AMQ_Distance</code>, <code>_AMQ_FilterString</code></p> |
| </li> |
| <li><p><code>CONSUMER_CREATED</code> (2)</p> |
| <p><code>_AMQ_Address</code>, <code>_AMQ_ClusterName</code>, <code>_AMQ_RoutingName</code>, <code>_AMQ_Distance</code>, |
| <code>_AMQ_ConsumerCount</code>, <code>_AMQ_User</code>, <code>_AMQ_RemoteAddress</code>, |
| <code>_AMQ_SessionName</code>, <code>_AMQ_FilterString</code></p> |
| </li> |
| <li><p><code>CONSUMER_CLOSED</code> (3)</p> |
| <p><code>_AMQ_Address</code>, <code>_AMQ_ClusterName</code>, <code>_AMQ_RoutingName</code>, <code>_AMQ_Distance</code>, |
| <code>_AMQ_ConsumerCount</code>, <code>_AMQ_User</code>, <code>_AMQ_RemoteAddress</code>, |
| <code>_AMQ_SessionName</code>, <code>_AMQ_FilterString</code></p> |
| </li> |
| <li><p><code>SECURITY_AUTHENTICATION_VIOLATION</code> (6)</p> |
| <p><code>_AMQ_User</code></p> |
| </li> |
| <li><p><code>SECURITY_PERMISSION_VIOLATION</code> (7)</p> |
| <p><code>_AMQ_Address</code>, <code>_AMQ_CheckType</code>, <code>_AMQ_User</code></p> |
| </li> |
| <li><p><code>DISCOVERY_GROUP_STARTED</code> (8)</p> |
| <p><code>name</code></p> |
| </li> |
| <li><p><code>DISCOVERY_GROUP_STOPPED</code> (9)</p> |
| <p><code>name</code></p> |
| </li> |
| <li><p><code>BROADCAST_GROUP_STARTED</code> (10)</p> |
| <p><code>name</code></p> |
| </li> |
| <li><p><code>BROADCAST_GROUP_STOPPED</code> (11)</p> |
| <p><code>name</code></p> |
| </li> |
| <li><p><code>BRIDGE_STARTED</code> (12)</p> |
| <p><code>name</code></p> |
| </li> |
| <li><p><code>BRIDGE_STOPPED</code> (13)</p> |
| <p><code>name</code></p> |
| </li> |
| <li><p><code>CLUSTER_CONNECTION_STARTED</code> (14)</p> |
| <p><code>name</code></p> |
| </li> |
| <li><p><code>CLUSTER_CONNECTION_STOPPED</code> (15)</p> |
| <p><code>name</code></p> |
| </li> |
| <li><p><code>ACCEPTOR_STARTED</code> (16)</p> |
| <p><code>factory</code>, <code>id</code></p> |
| </li> |
| <li><p><code>ACCEPTOR_STOPPED</code> (17)</p> |
| <p><code>factory</code>, <code>id</code></p> |
| </li> |
| <li><p><code>PROPOSAL</code> (18)</p> |
| <p><code>_JBM_ProposalGroupId</code>, <code>_JBM_ProposalValue</code>, <code>_AMQ_Binding_Type</code>, |
| <code>_AMQ_Address</code>, <code>_AMQ_Distance</code></p> |
| </li> |
| <li><p><code>PROPOSAL_RESPONSE</code> (19)</p> |
| <p><code>_JBM_ProposalGroupId</code>, <code>_JBM_ProposalValue</code>, |
| <code>_JBM_ProposalAltValue</code>, <code>_AMQ_Binding_Type</code>, <code>_AMQ_Address</code>, |
| <code>_AMQ_Distance</code></p> |
| </li> |
| <li><p><code>CONSUMER_SLOW</code> (21)</p> |
| <p><code>_AMQ_Address</code>, <code>_AMQ_ConsumerCount</code>, <code>_AMQ_RemoteAddress</code>, |
| <code>_AMQ_ConnectionName</code>, <code>_AMQ_ConsumerName</code>, <code>_AMQ_SessionName</code></p> |
| </li> |
| </ul> |
| <h2 id="message-counters">Message Counters</h2> |
| <p>Message counters can be used to obtain information on queues <em>over time</em> |
| as Apache ActiveMQ Artemis keeps a history on queue metrics.</p> |
| <p>They can be used to show <em>trends</em> on queues. For example, using the |
| management API, it would be possible to query the number of messages in |
| a queue at regular interval. However, this would not be enough to know |
| if the queue is used: the number of messages can remain constant because |
| nobody is sending or receiving messages from the queue or because there |
| are as many messages sent to the queue than messages consumed from it. |
| The number of messages in the queue remains the same in both cases but |
| its use is widely different.</p> |
| <p>Message counters gives additional information about the queues:</p> |
| <ul> |
| <li><p><code>count</code></p> |
| <p>The <em>total</em> number of messages added to the queue since the server |
| was started</p> |
| </li> |
| <li><p><code>countDelta</code></p> |
| <p>the number of messages added to the queue <em>since the last message |
| counter update</em></p> |
| </li> |
| <li><p><code>messageCount</code></p> |
| <p>The <em>current</em> number of messages in the queue</p> |
| </li> |
| <li><p><code>messageCountDelta</code></p> |
| <p>The <em>overall</em> number of messages added/removed from the queue <em>since |
| the last message counter update</em>. For example, if |
| <code>messageCountDelta</code> is equal to <code>-10</code> this means that overall 10 |
| messages have been removed from the queue (e.g. 2 messages were |
| added and 12 were removed)</p> |
| </li> |
| <li><p><code>lastAddTimestamp</code></p> |
| <p>The timestamp of the last time a message was added to the queue</p> |
| </li> |
| <li><p><code>udpateTimestamp</code></p> |
| <p>The timestamp of the last message counter update</p> |
| </li> |
| </ul> |
| <p>These attributes can be used to determine other meaningful data as well. |
| For example, to know specifically how many messages were <em>consumed</em> from |
| the queue since the last update simply subtract the <code>messageCountDelta</code> |
| from <code>countDelta</code>.</p> |
| <h3 id="configuring-message-counters">Configuring Message Counters</h3> |
| <p>By default, message counters are disabled as it might have a small |
| negative effect on memory.</p> |
| <p>To enable message counters, you can set it to <code>true</code> in |
| <code>broker.xml</code>:</p> |
| <pre><code><message-counter-enabled>true</message-counter-enabled> |
| </code></pre><p>Message counters keeps a history of the queue metrics (10 days by |
| default) and samples all the queues at regular interval (10 seconds by |
| default). If message counters are enabled, these values should be |
| configured to suit your messaging use case in |
| <code>broker.xml</code>:</p> |
| <pre><code><!-- keep history for a week --> |
| <message-counter-max-day-history>7</message-counter-max-day-history> |
| <!-- sample the queues every minute (60000ms) --> |
| <message-counter-sample-period>60000</message-counter-sample-period> |
| </code></pre><p>Message counters can be retrieved using the Management API. For example, |
| to retrieve message counters on a JMS Queue using JMX:</p> |
| <pre><code class="lang-java"><span class="hljs-comment">// retrieve a connection to Apache ActiveMQ Artemis's MBeanServer</span> |
| MBeanServerConnection mbsc = ... |
| JMSQueueControlMBean queueControl = (JMSQueueControl)MBeanServerInvocationHandler.newProxyInstance(mbsc, |
| on, |
| JMSQueueControl.class, |
| <span class="hljs-keyword">false</span>); |
| <span class="hljs-comment">// message counters are retrieved as a JSON String</span> |
| String counters = queueControl.listMessageCounter(); |
| <span class="hljs-comment">// use the MessageCounterInfo helper class to manipulate message counters more easily</span> |
| MessageCounterInfo messageCounter = MessageCounterInfo.fromJSON(counters); |
| System.out.format(<span class="hljs-string">"%s message(s) in the queue (since last sample: %s)\n"</span>, |
| messageCounter.getMessageCount(), |
| messageCounter.getMessageCountDelta()); |
| </code></pre> |
| <h3 id="example">Example</h3> |
| <p>See the <a href="examples.html">examples</a> chapter for an example which shows how to use message counters to retrieve information on a JMS <code>Queue</code>.</p> |
| |
| |
| </section> |
| |
| |
| </div> |
| </div> |
| </div> |
| |
| |
| <a href="./pre-acknowledge.html" class="navigation navigation-prev " aria-label="Previous page: Extra Acknowledge Modes"><i class="fa fa-angle-left"></i></a> |
| |
| |
| <a href="./security.html" class="navigation navigation-next " aria-label="Next page: Security"><i class="fa fa-angle-right"></i></a> |
| |
| </div> |
| </div> |
| |
| |
| <script src="gitbook/app.js"></script> |
| |
| <script> |
| require(["gitbook"], function(gitbook) { |
| var config = {"fontSettings":{"theme":null,"family":"sans","size":2}}; |
| gitbook.start(config); |
| }); |
| </script> |
| |
| |
| </body> |
| |
| </html> |