| <!DOCTYPE HTML> |
| <html lang="en" > |
| |
| <head> |
| |
| <meta charset="UTF-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| <title>Examples | 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="./wildcard-routing.html" /> |
| |
| |
| <link rel="prev" href="./client-classpath.html" /> |
| |
| |
| |
| </head> |
| <body> |
| |
| |
| <div class="book" data-level="11" data-basepath="." data-revision="Wed Sep 23 2015 12:51:51 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 active" 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 " 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="spring-integration.html"> |
| |
| |
| <a href="./spring-integration.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>47.</b> |
| |
| Spring Integration |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="48" data-path="aerogear-integration.html"> |
| |
| |
| <a href="./aerogear-integration.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>48.</b> |
| |
| AeroGear Integration |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="49" data-path="vertx-integration.html"> |
| |
| |
| <a href="./vertx-integration.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>49.</b> |
| |
| VertX Integration |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="50" data-path="intercepting-operations.html"> |
| |
| |
| <a href="./intercepting-operations.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>50.</b> |
| |
| Intercepting Operations |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="51" data-path="protocols-interoperability.html"> |
| |
| |
| <a href="./protocols-interoperability.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>51.</b> |
| |
| Protocols and Interoperability |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="52" data-path="tools.html"> |
| |
| |
| <a href="./tools.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>52.</b> |
| |
| Tools |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="53" data-path="maven-plugin.html"> |
| |
| |
| <a href="./maven-plugin.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>53.</b> |
| |
| Maven Plugin |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="54" data-path="perf-tuning.html"> |
| |
| |
| <a href="./perf-tuning.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>54.</b> |
| |
| Troubleshooting and Performance Tuning |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="55" data-path="configuration-index.html"> |
| |
| |
| <a href="./configuration-index.html"> |
| <i class="fa fa-check"></i> |
| |
| <b>55.</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="examples">Examples</h1> |
| <p>The Apache ActiveMQ Artemis distribution comes with over 90 run out-of-the-box examples |
| demonstrating many of the features.</p> |
| <p>The examples are available in both the binary and source distribution under the <code>examples</code> |
| directory. Examples are split by the following source tree:</p> |
| <ul> |
| <li>features - Examples containing broker specific features.<ul> |
| <li>ha - examples showing failover and reconnection capabilities.</li> |
| <li>clustered - examples showing load balancing and distribution capabilities.</li> |
| <li>perf - examples allowing you to run a few performance tests on the server</li> |
| <li>sub-modules - examples of integrated external modules.</li> |
| </ul> |
| </li> |
| <li>protocols - Protocol specific examples<ul> |
| <li>openwire</li> |
| <li>mqtt</li> |
| <li>stomp</li> |
| <li>amqp</li> |
| </ul> |
| </li> |
| </ul> |
| <p>A set of Java EE examples are also provided which need WildFly installed |
| to be able to run.</p> |
| <h1 id="examples">Examples</h1> |
| <p>To run any example, simply <code>cd</code> into the appropriate example directory |
| and type <code>mvn verify</code> or <code>mvn install</code> (For details please read the readme.html in each |
| example directory).</p> |
| <p>You can use the profile -Pexamples to run multiple examples under any example tree.</p> |
| <p>For each server, you will have a created server under ./target/server0 (some examples use more than one server).</p> |
| <p>You have the option to disable the server running (say if you want to start the server manually) by simply specifying the -PnoServer profile</p> |
| <p>This will run the example without a server:</p> |
| <pre><code class="lang-sh"><span class="hljs-comment"># running an example without running the server</span> |
| mvn verify -PnoServer |
| </code></pre> |
| <p>Also under ./target there will be a script repeating the commands to create each server:</p> |
| <p>Example this is create-server0.sh created for the queue example. It could be useful to see what we do on the example:</p> |
| <pre><code class="lang-sh"><span class="hljs-comment"># These are the commands used to create server0</span> |
| /myInstallDirectory/apache-artemis-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>/bin/artemis create --allow-anonymous --silent --force --no-web --user guest --password guest --role guest --port-offset <span class="hljs-number">0</span> --data ./data --allow-anonymous --no-autotune --verbose /myInstallDirectory/apache-artemis-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>/examples/features/standard/queue/target/server0 |
| </code></pre> |
| <p>These examples are all using the <a href="maven-plugin.html">Maven plugin</a>, which can be useful for running your test servers as well.</p> |
| <p>This is the common output when running an example. On this case taken from the Queue example:</p> |
| <pre><code class="lang-sh">[INFO] Scanning <span class="hljs-keyword">for</span> projects... |
| [INFO] |
| [INFO] ------------------------------------------------------------------------ |
| [INFO] Building ActiveMQ Artemis JMS Queue Example <span class="hljs-number">1.1</span>.<span class="hljs-number">0</span> |
| [INFO] ------------------------------------------------------------------------ |
| [INFO] |
| [INFO] --- maven-enforcer-plugin:<span class="hljs-number">1.4</span>:enforce (enforce-java) @ queue --- |
| [INFO] |
| [INFO] --- maven-remote-resources-plugin:<span class="hljs-number">1.5</span>:process (default) @ queue --- |
| [INFO] |
| [INFO] --- maven-resources-plugin:<span class="hljs-number">2.6</span>:resources (default-resources) @ queue --- |
| [INFO] Using <span class="hljs-string">'UTF-8'</span> encoding to copy filtered resources. |
| [INFO] Copying <span class="hljs-number">1</span> resource |
| [INFO] Copying <span class="hljs-number">3</span> resources |
| [INFO] |
| [INFO] --- maven-compiler-plugin:<span class="hljs-number">3.1</span>:compile (default-compile) @ queue --- |
| [INFO] Changes detected - recompiling the module! |
| [INFO] Compiling <span class="hljs-number">1</span> <span class="hljs-built_in">source</span> file to /work/apache-artemis-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>/examples/features/standard/queue/target/classes |
| [INFO] |
| [INFO] --- maven-checkstyle-plugin:<span class="hljs-number">2.16</span>:check (default) @ queue --- |
| [INFO] |
| [INFO] --- apache-rat-plugin:<span class="hljs-number">0.11</span>:check (default) @ queue --- |
| [INFO] RAT will not execute since it is configured to be skipped via system property <span class="hljs-string">'rat.skip'</span>. |
| [INFO] |
| [INFO] --- maven-resources-plugin:<span class="hljs-number">2.6</span>:<span class="hljs-built_in">test</span>Resources (default-testResources) @ queue --- |
| [INFO] Using <span class="hljs-string">'UTF-8'</span> encoding to copy filtered resources. |
| [INFO] skip non existing resourceDirectory /work/apache-artemis-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>/examples/features/standard/queue/src/<span class="hljs-built_in">test</span>/resources |
| [INFO] Copying <span class="hljs-number">3</span> resources |
| [INFO] |
| [INFO] --- maven-compiler-plugin:<span class="hljs-number">3.1</span>:<span class="hljs-built_in">test</span>Compile (default-testCompile) @ queue --- |
| [INFO] No sources to compile |
| [INFO] |
| [INFO] --- maven-surefire-plugin:<span class="hljs-number">2.18</span>.<span class="hljs-number">1</span>:<span class="hljs-built_in">test</span> (default-test) @ queue --- |
| [INFO] |
| [INFO] --- maven-jar-plugin:<span class="hljs-number">2.4</span>:jar (default-jar) @ queue --- |
| [INFO] Building jar: /work/apache-artemis-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>/examples/features/standard/queue/target/queue-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>.jar |
| [INFO] |
| [INFO] --- maven-site-plugin:<span class="hljs-number">3.3</span>:attach-descriptor (attach-descriptor) @ queue --- |
| [INFO] |
| [INFO] >>> maven-source-plugin:<span class="hljs-number">2.2</span>.<span class="hljs-number">1</span>:jar (attach-sources) > generate-sources @ queue >>> |
| [INFO] |
| [INFO] --- maven-enforcer-plugin:<span class="hljs-number">1.4</span>:enforce (enforce-java) @ queue --- |
| [INFO] |
| [INFO] <<< maven-source-plugin:<span class="hljs-number">2.2</span>.<span class="hljs-number">1</span>:jar (attach-sources) < generate-sources @ queue <<< |
| [INFO] |
| [INFO] --- maven-source-plugin:<span class="hljs-number">2.2</span>.<span class="hljs-number">1</span>:jar (attach-sources) @ queue --- |
| [INFO] Building jar: /work/apache-artemis-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>/examples/features/standard/queue/target/queue-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>-sources.jar |
| [INFO] |
| [INFO] >>> maven-source-plugin:<span class="hljs-number">2.2</span>.<span class="hljs-number">1</span>:jar (default) > generate-sources @ queue >>> |
| [INFO] |
| [INFO] --- maven-enforcer-plugin:<span class="hljs-number">1.4</span>:enforce (enforce-java) @ queue --- |
| [INFO] |
| [INFO] <<< maven-source-plugin:<span class="hljs-number">2.2</span>.<span class="hljs-number">1</span>:jar (default) < generate-sources @ queue <<< |
| [INFO] |
| [INFO] --- maven-source-plugin:<span class="hljs-number">2.2</span>.<span class="hljs-number">1</span>:jar (default) @ queue --- |
| [INFO] |
| [INFO] --- artemis-maven-plugin:<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>:create (create) @ queue --- |
| [INFO] Local id: <span class="hljs-built_in">local</span> |
| url: file:///Users/apacheuser/.m2/repository/ |
| layout: default |
| snapshots: [enabled => <span class="hljs-literal">true</span>, update => always] |
| releases: [enabled => <span class="hljs-literal">true</span>, update => always] |
| |
| [INFO] Entries.size <span class="hljs-number">2</span> |
| [INFO] ... key=project = MavenProject: org.apache.activemq.examples.broker:queue:<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span> @ /work/apache-artemis-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>/examples/features/standard/queue/pom.xml |
| [INFO] ... key=pluginDescriptor = Component Descriptor: role: <span class="hljs-string">'org.apache.maven.plugin.Mojo'</span>, implementation: <span class="hljs-string">'org.apache.activemq.artemis.maven.ArtemisCLIPlugin'</span>, role hint: <span class="hljs-string">'org.apache.activemq:artemis-maven-plugin:1.1.0:cli'</span> |
| role: <span class="hljs-string">'org.apache.maven.plugin.Mojo'</span>, implementation: <span class="hljs-string">'org.apache.activemq.artemis.maven.ArtemisCreatePlugin'</span>, role hint: <span class="hljs-string">'org.apache.activemq:artemis-maven-plugin:1.1.0:create'</span> |
| role: <span class="hljs-string">'org.apache.maven.plugin.Mojo'</span>, implementation: <span class="hljs-string">'org.apache.activemq.artemis.maven.ArtemisClientPlugin'</span>, role hint: <span class="hljs-string">'org.apache.activemq:artemis-maven-plugin:1.1.0:runClient'</span> |
| --- |
| Executing org.apache.activemq.artemis.cli.commands.Create create --allow-anonymous --silent --force --no-web --user guest --password guest --role guest --port-offset <span class="hljs-number">0</span> --data ./data --allow-anonymous --no-autotune --verbose /work/apache-artemis-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>/examples/features/standard/queue/target/server0 |
| Home::/work/apache-artemis-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>/examples/features/standard/queue/../../../.., Instance::. |
| Creating ActiveMQ Artemis instance at: /work/apache-artemis-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>/examples/features/standard/queue/target/server0 |
| |
| You can now start the broker by executing: |
| |
| <span class="hljs-string">"/work/apache-artemis-1.1.0/examples/features/standard/queue/target/server0/bin/artemis"</span> run |
| |
| Or you can run the broker <span class="hljs-keyword">in</span> the background using: |
| |
| <span class="hljs-string">"/work/apache-artemis-1.1.0/examples/features/standard/queue/target/server0/bin/artemis-service"</span> start |
| |
| [INFO] <span class="hljs-comment">###################################################################################################</span> |
| [INFO] create-server0.sh created with commands to reproduce server0 |
| [INFO] under /work/apache-artemis-<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>/examples/features/standard/queue/target |
| [INFO] <span class="hljs-comment">###################################################################################################</span> |
| [INFO] |
| [INFO] --- artemis-maven-plugin:<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>:cli (start) @ queue --- |
| [INFO] awaiting server to start |
| [INFO] awaiting server to start |
| server-out: _ _ _ |
| server-out: / \ ____| |_ ___ __ __(_) _____ |
| server-out: / _ \| _ \ __|/ _ \ \/ | |/ __/ |
| server-out: / ___ \ | \/ |_/ __/ |\/| | |\___ \ |
| server-out: /_/ \_\| \__\____|_| |_|_|/___ / |
| server-out: Apache ActiveMQ Artemis <span class="hljs-number">1.1</span>.<span class="hljs-number">0</span> |
| server-out: |
| server-out: |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">091</span> INFO [org.apache.activemq.artemis.integration.bootstrap] AMQ101000: Starting ActiveMQ Artemis Server |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">120</span> INFO [org.apache.activemq.artemis.core.server] AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=<span class="hljs-literal">false</span>,journalDirectory=./data/journal,bindingsDirectory=./data/bindings,largeMessagesDirectory=./data/large-messages,pagingDirectory=./data/paging) |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">152</span> INFO [org.apache.activemq.artemis.core.server] AMQ221013: Using NIO Journal |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">195</span> INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-server]. Adding protocol support <span class="hljs-keyword">for</span>: CORE |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">199</span> INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support <span class="hljs-keyword">for</span>: AMQP |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">209</span> INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support <span class="hljs-keyword">for</span>: HORNETQ |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">211</span> INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support <span class="hljs-keyword">for</span>: MQTT |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">214</span> INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-openwire-protocol]. Adding protocol support <span class="hljs-keyword">for</span>: OPENWIRE |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">335</span> INFO [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support <span class="hljs-keyword">for</span>: STOMP |
| [INFO] awaiting server to start |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">781</span> INFO [org.apache.activemq.artemis.core.server] AMQ221003: trying to deploy queue jms.queue.DLQ |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">835</span> INFO [org.apache.activemq.artemis.core.server] AMQ221003: trying to deploy queue jms.queue.ExpiryQueue |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">933</span> INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at <span class="hljs-number">0.0</span>.<span class="hljs-number">0.0</span>:<span class="hljs-number">61616</span> <span class="hljs-keyword">for</span> protocols [CORE,MQTT,AMQP,HORNETQ,STOMP,OPENWIRE] |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">936</span> INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at <span class="hljs-number">0.0</span>.<span class="hljs-number">0.0</span>:<span class="hljs-number">5445</span> <span class="hljs-keyword">for</span> protocols [HORNETQ,STOMP] |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">939</span> INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at <span class="hljs-number">0.0</span>.<span class="hljs-number">0.0</span>:<span class="hljs-number">5672</span> <span class="hljs-keyword">for</span> protocols [AMQP] |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">944</span> INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at <span class="hljs-number">0.0</span>.<span class="hljs-number">0.0</span>:<span class="hljs-number">1883</span> <span class="hljs-keyword">for</span> protocols [MQTT] |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">948</span> INFO [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at <span class="hljs-number">0.0</span>.<span class="hljs-number">0.0</span>:<span class="hljs-number">61613</span> <span class="hljs-keyword">for</span> protocols [STOMP] |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">949</span> INFO [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">25</span>,<span class="hljs-number">949</span> INFO [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version <span class="hljs-number">1.1</span>.<span class="hljs-number">0</span> [nodeID=a855176b-<span class="hljs-number">50</span>f0-<span class="hljs-number">11</span>e5-<span class="hljs-number">937</span>e-<span class="hljs-number">2</span>fe9bb000966] |
| [INFO] Server started |
| [INFO] |
| [INFO] --- artemis-maven-plugin:<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>:runClient (runClient) @ queue --- |
| Sent message: This is a text message |
| Received message: This is a text message |
| [INFO] |
| [INFO] --- artemis-maven-plugin:<span class="hljs-number">1.1</span>.<span class="hljs-number">0</span>:cli (stop) @ queue --- |
| server-out:<span class="hljs-number">17</span>:<span class="hljs-number">30</span>:<span class="hljs-number">27</span>,<span class="hljs-number">476</span> INFO [org.apache.activemq.artemis.core.server] AMQ221002: Apache ActiveMQ Artemis Message Broker version <span class="hljs-number">1.0</span>.<span class="hljs-number">1</span>-SNA |
| [INFO] ------------------------------------------------------------------------ |
| [INFO] BUILD SUCCESS |
| [INFO] ------------------------------------------------------------------------ |
| [INFO] Total time: <span class="hljs-number">7.840</span> s |
| [INFO] Finished at: <span class="hljs-number">2015</span>-<span class="hljs-number">09</span>-<span class="hljs-number">01</span>T17:<span class="hljs-number">30</span>:<span class="hljs-number">27</span>-<span class="hljs-number">04</span>:<span class="hljs-number">00</span> |
| [INFO] Final Memory: <span class="hljs-number">42</span>M/<span class="hljs-number">508</span>M |
| [INFO] ------------------------------------------------------------------------ |
| </code></pre> |
| <h2 id="applet">Applet</h2> |
| <p>This example shows you how to send and receive JMS messages from an |
| Applet.</p> |
| <h2 id="application-layer-failover">Application-Layer Failover</h2> |
| <p>Apache ActiveMQ Artemis also supports Application-Layer failover, useful in the case |
| that replication is not enabled on the server side.</p> |
| <p>With Application-Layer failover, it's up to the application to register |
| a JMS <code>ExceptionListener</code> with Apache ActiveMQ Artemis which will be called by Apache ActiveMQ Artemis |
| in the event that connection failure is detected.</p> |
| <p>The code in the <code>ExceptionListener</code> then recreates the JMS connection, |
| session, etc on another node and the application can continue.</p> |
| <p>Application-layer failover is an alternative approach to High |
| Availability (HA). Application-layer failover differs from automatic |
| failover in that some client side coding is required in order to |
| implement this. Also, with Application-layer failover, since the old |
| session object dies and a new one is created, any uncommitted work in |
| the old session will be lost, and any unacknowledged messages might be |
| redelivered.</p> |
| <h2 id="core-bridge-example">Core Bridge Example</h2> |
| <p>The <code>bridge</code> example demonstrates a core bridge deployed on one server, |
| which consumes messages from a local queue and forwards them to an |
| address on a second server.</p> |
| <p>Core bridges are used to create message flows between any two Apache ActiveMQ Artemis |
| servers which are remotely separated. Core bridges are resilient and |
| will cope with temporary connection failure allowing them to be an ideal |
| choice for forwarding over unreliable connections, e.g. a WAN.</p> |
| <h2 id="browser">Browser</h2> |
| <p>The <code>browser</code> example shows you how to use a JMS <code>QueueBrowser</code> with |
| Apache ActiveMQ Artemis.</p> |
| <p>Queues are a standard part of JMS, please consult the JMS 1.1 |
| specification for full details.</p> |
| <p>A <code>QueueBrowser</code> is used to look at messages on the queue without |
| removing them. It can scan the entire content of a queue or only |
| messages matching a message selector.</p> |
| <h2 id="client-kickoff">Client Kickoff</h2> |
| <p>The <code>client-kickoff</code> example shows how to terminate client connections |
| given an IP address using the JMX management API.</p> |
| <h2 id="client-side-failover-listener">Client side failover listener</h2> |
| <p>The <code>client-side-failoverlistener</code> example shows how to register a |
| listener to monitor failover events</p> |
| <h2 id="client-side-load-balancing">Client-Side Load-Balancing</h2> |
| <p>The <code>client-side-load-balancing</code> example demonstrates how sessions |
| created from a single JMS <code>Connection</code> can be created to different nodes |
| of the cluster. In other words it demonstrates how Apache ActiveMQ Artemis does |
| client-side load-balancing of sessions across the cluster.</p> |
| <h2 id="clustered-durable-subscription">Clustered Durable Subscription</h2> |
| <p>This example demonstrates a clustered JMS durable subscription</p> |
| <h2 id="clustered-grouping">Clustered Grouping</h2> |
| <p>This is similar to the message grouping example except that it |
| demonstrates it working over a cluster. Messages sent to different nodes |
| with the same group id will be sent to the same node and the same |
| consumer.</p> |
| <h2 id="clustered-queue">Clustered Queue</h2> |
| <p>The <code>clustered-queue</code> example demonstrates a JMS queue deployed on two |
| different nodes. The two nodes are configured to form a cluster. We then |
| create a consumer for the queue on each node, and we create a producer |
| on only one of the nodes. We then send some messages via the producer, |
| and we verify that both consumers receive the sent messages in a |
| round-robin fashion.</p> |
| <h2 id="clustering-with-jgroups">Clustering with JGroups</h2> |
| <p>The <code>clustered-jgroups</code> example demonstrates how to form a two node |
| cluster using JGroups as its underlying topology discovery technique, |
| rather than the default UDP broadcasting. We then create a consumer for |
| the queue on each node, and we create a producer on only one of the |
| nodes. We then send some messages via the producer, and we verify that |
| both consumers receive the sent messages in a round-robin fashion.</p> |
| <h2 id="clustered-standalone">Clustered Standalone</h2> |
| <p>The <code>clustered-standalone</code> example demonstrates how to configure and |
| starts 3 cluster nodes on the same machine to form a cluster. A |
| subscriber for a JMS topic is created on each node, and we create a |
| producer on only one of the nodes. We then send some messages via the |
| producer, and we verify that the 3 subscribers receive all the sent |
| messages.</p> |
| <h2 id="clustered-static-discovery">Clustered Static Discovery</h2> |
| <p>This example demonstrates how to configure a cluster using a list of |
| connectors rather than UDP for discovery</p> |
| <h2 id="clustered-static-cluster-one-way">Clustered Static Cluster One Way</h2> |
| <p>This example demonstrates how to set up a cluster where cluster |
| connections are one way, i.e. server A -> Server B -> Server C</p> |
| <h2 id="clustered-topic">Clustered Topic</h2> |
| <p>The <code>clustered-topic</code> example demonstrates a JMS topic deployed on two |
| different nodes. The two nodes are configured to form a cluster. We then |
| create a subscriber on the topic on each node, and we create a producer |
| on only one of the nodes. We then send some messages via the producer, |
| and we verify that both subscribers receive all the sent messages.</p> |
| <h2 id="message-consumer-rate-limiting">Message Consumer Rate Limiting</h2> |
| <p>With Apache ActiveMQ Artemis you can specify a maximum consume rate at which a JMS |
| MessageConsumer will consume messages. This can be specified when |
| creating or deploying the connection factory.</p> |
| <p>If this value is specified then Apache ActiveMQ Artemis will ensure that messages are |
| never consumed at a rate higher than the specified rate. This is a form |
| of consumer throttling.</p> |
| <h2 id="dead-letter">Dead Letter</h2> |
| <p>The <code>dead-letter</code> example shows you how to define and deal with dead |
| letter messages. Messages can be delivered unsuccessfully (e.g. if the |
| transacted session used to consume them is rolled back).</p> |
| <p>Such a message goes back to the JMS destination ready to be redelivered. |
| However, this means it is possible for a message to be delivered again |
| and again without any success and remain in the destination, clogging |
| the system.</p> |
| <p>To prevent this, messaging systems define dead letter messages: after a |
| specified unsuccessful delivery attempts, the message is removed from |
| the destination and put instead in a dead letter destination where they |
| can be consumed for further investigation.</p> |
| <h2 id="delayed-redelivery">Delayed Redelivery</h2> |
| <p>The <code>delayed-redelivery</code> example demonstrates how Apache ActiveMQ Artemis can be |
| configured to provide a delayed redelivery in the case a message needs |
| to be redelivered.</p> |
| <p>Delaying redelivery can often be useful in the case that clients |
| regularly fail or roll-back. Without a delayed redelivery, the system |
| can get into a "thrashing" state, with delivery being attempted, the |
| client rolling back, and delivery being re-attempted in quick |
| succession, using up valuable CPU and network resources.</p> |
| <h2 id="divert">Divert</h2> |
| <p>Apache ActiveMQ Artemis diverts allow messages to be transparently "diverted" or copied |
| from one address to another with just some simple configuration defined |
| on the server side.</p> |
| <h2 id="durable-subscription">Durable Subscription</h2> |
| <p>The <code>durable-subscription</code> example shows you how to use a durable |
| subscription with Apache ActiveMQ Artemis. Durable subscriptions are a standard part of |
| JMS, please consult the JMS 1.1 specification for full details.</p> |
| <p>Unlike non-durable subscriptions, the key function of durable |
| subscriptions is that the messages contained in them persist longer than |
| the lifetime of the subscriber - i.e. they will accumulate messages sent |
| to the topic even if there is no active subscriber on them. They will |
| also survive server restarts or crashes. Note that for the messages to |
| be persisted, the messages sent to them must be marked as durable |
| messages.</p> |
| <h2 id="embedded">Embedded</h2> |
| <p>The <code>embedded</code> example shows how to embed JMS within your own code using |
| POJO instantiation and no config files.</p> |
| <h2 id="embedded-simple">Embedded Simple</h2> |
| <p>The <code>embedded</code> example shows how to embed JMS within your own code using |
| regular Apache ActiveMQ Artemis XML files.</p> |
| <h2 id="message-expiration">Message Expiration</h2> |
| <p>The <code>expiry</code> example shows you how to define and deal with message |
| expiration. Messages can be retained in the messaging system for a |
| limited period of time before being removed. JMS specification states |
| that clients should not receive messages that have been expired (but it |
| does not guarantee this will not happen).</p> |
| <p>Apache ActiveMQ Artemis can assign an expiry address to a given queue so that when |
| messages are expired, they are removed from the queue and sent to the |
| expiry address. These "expired" messages can later be consumed from the |
| expiry address for further inspection.</p> |
| <h2 id="apache-activemq-artemis-resource-adapter-example">Apache ActiveMQ Artemis Resource Adapter example</h2> |
| <p>This examples shows how to build the activemq resource adapters a rar |
| for deployment in other Application Server's</p> |
| <h2 id="http-transport">HTTP Transport</h2> |
| <p>The <code>http-transport</code> example shows you how to configure Apache ActiveMQ Artemis to use |
| the HTTP protocol as its transport layer.</p> |
| <h2 id="instantiate-jms-objects-directly">Instantiate JMS Objects Directly</h2> |
| <p>Usually, JMS Objects such as <code>ConnectionFactory</code>, <code>Queue</code> and <code>Topic</code> |
| instances are looked up from JNDI before being used by the client code. |
| This objects are called "administered objects" in JMS terminology.</p> |
| <p>However, in some cases a JNDI server may not be available or desired. To |
| come to the rescue Apache ActiveMQ Artemis also supports the direct instantiation of |
| these administered objects on the client side so you don't have to use |
| JNDI for JMS.</p> |
| <h2 id="interceptor">Interceptor</h2> |
| <p>Apache ActiveMQ Artemis allows an application to use an interceptor to hook into the |
| messaging system. Interceptors allow you to handle various message |
| events in Apache ActiveMQ Artemis.</p> |
| <h2 id="jaas">JAAS</h2> |
| <p>The <code>jaas</code> example shows you how to configure Apache ActiveMQ Artemis to use JAAS for |
| security. Apache ActiveMQ Artemis can leverage JAAS to delegate user authentication and |
| authorization to existing security infrastructure.</p> |
| <h2 id="jms-auto-closable">JMS Auto Closable</h2> |
| <p>The <code>jms-auto-closeable</code> example shows how JMS resources, such as |
| connections, sessions and consumers, in JMS 2 can be automatically |
| closed on error.</p> |
| <h2 id="jms-completion-listener">JMS Completion Listener</h2> |
| <p>The <code>jms-completion-listener</code> example shows how to send a message |
| asynchronously to Apache ActiveMQ Artemis and use a CompletionListener to be notified |
| of the Broker receiving it.</p> |
| <h2 id="jms-bridge">JMS Bridge</h2> |
| <p>The <code>jms-brige</code> example shows how to setup a bridge between two |
| standalone Apache ActiveMQ Artemis servers.</p> |
| <h2 id="jms-context">JMS Context</h2> |
| <p>The <code>jms-context</code> example shows how to send and receive a message to a |
| JMS Queue using Apache ActiveMQ Artemis by using a JMS Context.</p> |
| <p>A JMSContext is part of JMS 2.0 and combines the JMS Connection and |
| Session Objects into a simple Interface.</p> |
| <h2 id="jms-shared-consumer">JMS Shared Consumer</h2> |
| <p>The <code>jms-shared-consumer</code> example shows you how can use shared consumers |
| to share a subscription on a topic. In JMS 1.1 this was not allowed and |
| so caused a scalability issue. In JMS 2 this restriction has been lifted |
| so you can share the load across different threads and connections.</p> |
| <h2 id="jmx-management">JMX Management</h2> |
| <p>The <code>jmx</code> example shows how to manage Apache ActiveMQ Artemis using JMX.</p> |
| <h2 id="large-message">Large Message</h2> |
| <p>The <code>large-message</code> example shows you how to send and receive very large |
| messages with Apache ActiveMQ Artemis. Apache ActiveMQ Artemis supports the sending and receiving of |
| huge messages, much larger than can fit in available RAM on the client |
| or server. Effectively the only limit to message size is the amount of |
| disk space you have on the server.</p> |
| <p>Large messages are persisted on the server so they can survive a server |
| restart. In other words Apache ActiveMQ Artemis doesn't just do a simple socket stream |
| from the sender to the consumer.</p> |
| <h2 id="last-value-queue">Last-Value Queue</h2> |
| <p>The <code>last-value-queue</code> example shows you how to define and deal with |
| last-value queues. Last-value queues are special queues which discard |
| any messages when a newer message with the same value for a well-defined |
| last-value property is put in the queue. In other words, a last-value |
| queue only retains the last value.</p> |
| <p>A typical example for last-value queue is for stock prices, where you |
| are only interested by the latest price for a particular stock.</p> |
| <h2 id="management">Management</h2> |
| <p>The <code>management</code> example shows how to manage Apache ActiveMQ Artemis using JMS Messages |
| to invoke management operations on the server.</p> |
| <h2 id="management-notification">Management Notification</h2> |
| <p>The <code>management-notification</code> example shows how to receive management |
| notifications from Apache ActiveMQ Artemis using JMS messages. Apache ActiveMQ Artemis servers emit |
| management notifications when events of interest occur (consumers are |
| created or closed, addresses are created or deleted, security |
| authentication fails, etc.).</p> |
| <h2 id="message-counter">Message Counter</h2> |
| <p>The <code>message-counters</code> example shows you how to use message counters to |
| obtain message information for a JMS queue.</p> |
| <h2 id="message-group">Message Group</h2> |
| <p>The <code>message-group</code> example shows you how to configure and use message |
| groups with Apache ActiveMQ Artemis. Message groups allow you to pin messages so they |
| are only consumed by a single consumer. Message groups are sets of |
| messages that has the following characteristics:</p> |
| <ul> |
| <li><p>Messages in a message group share the same group id, i.e. they have |
| same JMSXGroupID string property values</p> |
| </li> |
| <li><p>The consumer that receives the first message of a group will receive |
| all the messages that belongs to the group</p> |
| </li> |
| </ul> |
| <h2 id="message-group">Message Group</h2> |
| <p>The <code>message-group2</code> example shows you how to configure and use message |
| groups with Apache ActiveMQ Artemis via a connection factory.</p> |
| <h2 id="message-priority">Message Priority</h2> |
| <p>Message Priority can be used to influence the delivery order for |
| messages.</p> |
| <p>It can be retrieved by the message's standard header field 'JMSPriority' |
| as defined in JMS specification version 1.1.</p> |
| <p>The value is of type integer, ranging from 0 (the lowest) to 9 (the |
| highest). When messages are being delivered, their priorities will |
| effect their order of delivery. Messages of higher priorities will |
| likely be delivered before those of lower priorities.</p> |
| <p>Messages of equal priorities are delivered in the natural order of their |
| arrival at their destinations. Please consult the JMS 1.1 specification |
| for full details.</p> |
| <h2 id="multiple-failover">Multiple Failover</h2> |
| <p>This example demonstrates how to set up a live server with multiple |
| backups</p> |
| <h2 id="multiple-failover-failback">Multiple Failover Failback</h2> |
| <p>This example demonstrates how to set up a live server with multiple |
| backups but forcing failover back to the original live server</p> |
| <h2 id="no-consumer-buffering">No Consumer Buffering</h2> |
| <p>By default, Apache ActiveMQ Artemis consumers buffer messages from the server in a |
| client side buffer before you actually receive them on the client side. |
| This improves performance since otherwise every time you called |
| receive() or had processed the last message in a |
| <code>MessageListener onMessage()</code> method, the Apache ActiveMQ Artemis client would have to |
| go the server to request the next message, which would then get sent to |
| the client side, if one was available.</p> |
| <p>This would involve a network round trip for every message and reduce |
| performance. Therefore, by default, Apache ActiveMQ Artemis pre-fetches messages into a |
| buffer on each consumer.</p> |
| <p>In some case buffering is not desirable, and Apache ActiveMQ Artemis allows it to be |
| switched off. This example demonstrates that.</p> |
| <h2 id="non-transaction-failover-with-server-data-replication">Non-Transaction Failover With Server Data Replication</h2> |
| <p>The <code>non-transaction-failover</code> example demonstrates two servers coupled |
| as a live-backup pair for high availability (HA), and a client using a |
| <em>non-transacted</em> JMS session failing over from live to backup when the |
| live server is crashed.</p> |
| <p>Apache ActiveMQ Artemis implements failover of client connections between live and |
| backup servers. This is implemented by the replication of state between |
| live and backup nodes. When replication is configured and a live node |
| crashes, the client connections can carry and continue to send and |
| consume messages. When non-transacted sessions are used, once and only |
| once message delivery is not guaranteed and it is possible that some |
| messages will be lost or delivered twice.</p> |
| <h2 id="openwire">OpenWire</h2> |
| <p>The <code>Openwire</code> example shows how to configure an Apache ActiveMQ Artemis server to |
| communicate with an Apache ActiveMQ Artemis JMS client that uses open-wire protocol.</p> |
| <p>You will find the queue example for open wire, and the chat example.</p> |
| <h2 id="paging">Paging</h2> |
| <p>The <code>paging</code> example shows how Apache ActiveMQ Artemis can support huge queues even |
| when the server is running in limited RAM. It does this by transparently |
| <em>paging</em> messages to disk, and <em>depaging</em> them when they are required.</p> |
| <h2 id="pre-acknowledge">Pre-Acknowledge</h2> |
| <p>Standard JMS supports three acknowledgement modes:<code>AUTO_ACKNOWLEDGE</code>, <code>CLIENT_ACKNOWLEDGE</code>, and |
| <code>DUPS_OK_ACKNOWLEDGE</code>. For a full description on these modes please |
| consult the JMS specification, or any JMS tutorial.</p> |
| <p>All of these standard modes involve sending acknowledgements from the |
| client to the server. However in some cases, you really don't mind |
| losing messages in event of failure, so it would make sense to |
| acknowledge the message on the server before delivering it to the |
| client. This example demonstrates how Apache ActiveMQ Artemis allows this with an extra |
| acknowledgement mode.</p> |
| <h2 id="message-producer-rate-limiting">Message Producer Rate Limiting</h2> |
| <p>The <code>producer-rte-limit</code> example demonstrates how, with Apache ActiveMQ Artemis, you |
| can specify a maximum send rate at which a JMS message producer will |
| send messages.</p> |
| <h2 id="proton-qpid">Proton Qpid</h2> |
| <p>Apache ActiveMQ Artemis can be configured to accept requests from any AMQP client that |
| supports the 1.0 version of the protocol. This <code>proton-j</code> example shows |
| a simply qpid java 1.0 client example.</p> |
| <h2 id="proton-ruby">Proton Ruby</h2> |
| <p>Apache ActiveMQ Artemis can be configured to accept requests from any AMQP client that |
| supports the 1.0 version of the protocol. This example shows a simply |
| proton ruby client that sends and receives messages</p> |
| <h2 id="queue">Queue</h2> |
| <p>A simple example demonstrating a JMS queue.</p> |
| <h2 id="message-redistribution">Message Redistribution</h2> |
| <p>The <code>queue-message-redistribution</code> example demonstrates message |
| redistribution between queues with the same name deployed in different |
| nodes of a cluster.</p> |
| <h2 id="queue-requestor">Queue Requestor</h2> |
| <p>A simple example demonstrating a JMS queue requestor.</p> |
| <h2 id="queue-with-message-selector">Queue with Message Selector</h2> |
| <p>The <code>queue-selector</code> example shows you how to selectively consume |
| messages using message selectors with queue consumers.</p> |
| <h2 id="reattach-node-example">Reattach Node example</h2> |
| <p>The <code>Reattach Node</code> example shows how a client can try to reconnect to |
| the same server instead of failing the connection immediately and |
| notifying any user ExceptionListener objects. Apache ActiveMQ Artemis can be configured |
| to automatically retry the connection, and reattach to the server when |
| it becomes available again across the network.</p> |
| <h2 id="replicated-failback-example">Replicated Failback example</h2> |
| <p>An example showing how failback works when using replication, In this |
| example a live server will replicate all its Journal to a backup server |
| as it updates it. When the live server crashes the backup takes over |
| from the live server and the client reconnects and carries on from where |
| it left off.</p> |
| <h2 id="replicated-failback-static-example">Replicated Failback static example</h2> |
| <p>An example showing how failback works when using replication, but this |
| time with static connectors</p> |
| <h2 id="replicated-multiple-failover-example">Replicated multiple failover example</h2> |
| <p>An example showing how to configure multiple backups when using |
| replication</p> |
| <h2 id="replicated-failover-transaction-example">Replicated Failover transaction example</h2> |
| <p>An example showing how failover works with a transaction when using |
| replication</p> |
| <h2 id="request-reply-example">Request-Reply example</h2> |
| <p>A simple example showing the JMS request-response pattern.</p> |
| <h2 id="rest-example">Rest example</h2> |
| <p>An example showing how to use the Apache ActiveMQ Artemis Rest API</p> |
| <h2 id="scheduled-message">Scheduled Message</h2> |
| <p>The <code>scheduled-message</code> example shows you how to send a scheduled |
| message to a JMS Queue with Apache ActiveMQ Artemis. Scheduled messages won't get |
| delivered until a specified time in the future.</p> |
| <h2 id="security">Security</h2> |
| <p>The <code>security</code> example shows you how configure and use role based queue |
| security with Apache ActiveMQ Artemis.</p> |
| <h2 id="send-acknowledgements">Send Acknowledgements</h2> |
| <p>The <code>send-acknowledgements</code> example shows you how to use Apache ActiveMQ Artemis's |
| advanced <em>asynchronous send acknowledgements</em> feature to obtain |
| acknowledgement from the server that sends have been received and |
| processed in a separate stream to the sent messages.</p> |
| <h2 id="spring-integration">Spring Integration</h2> |
| <p>This example shows how to use embedded JMS using Apache ActiveMQ Artemis's Spring |
| integration.</p> |
| <h2 id="ssl-transport">SSL Transport</h2> |
| <p>The <code>ssl-enabled</code> shows you how to configure SSL with Apache ActiveMQ Artemis to send |
| and receive message.</p> |
| <h2 id="static-message-selector">Static Message Selector</h2> |
| <p>The <code>static-selector</code> example shows you how to configure an Apache ActiveMQ Artemis core |
| queue with static message selectors (filters).</p> |
| <h2 id="static-message-selector-using-jms">Static Message Selector Using JMS</h2> |
| <p>The <code>static-selector-jms</code> example shows you how to configure an Apache ActiveMQ Artemis |
| queue with static message selectors (filters) using JMS.</p> |
| <h2 id="stomp">Stomp</h2> |
| <p>The <code>stomp</code> example shows you how to configure an Apache ActiveMQ Artemis server to send |
| and receive Stomp messages.</p> |
| <h2 id="stomp1-1">Stomp1.1</h2> |
| <p>The <code>stomp</code> example shows you how to configure an Apache ActiveMQ Artemis server to send |
| and receive Stomp messages via a Stomp 1.1 connection.</p> |
| <h2 id="stomp1-2">Stomp1.2</h2> |
| <p>The <code>stomp</code> example shows you how to configure an Apache ActiveMQ Artemis server to send |
| and receive Stomp messages via a Stomp 1.2 connection.</p> |
| <h2 id="stomp-over-web-sockets">Stomp Over Web Sockets</h2> |
| <p>The <code>stomp-websockets</code> example shows you how to configure an Apache ActiveMQ Artemis |
| server to send and receive Stomp messages directly from Web browsers |
| (provided they support Web Sockets).</p> |
| <h2 id="symmetric-cluster">Symmetric Cluster</h2> |
| <p>The <code>symmetric-cluster</code> example demonstrates a symmetric cluster set-up |
| with Apache ActiveMQ Artemis.</p> |
| <p>Apache ActiveMQ Artemis has extremely flexible clustering which allows you to set-up |
| servers in many different topologies. The most common topology that |
| you'll perhaps be familiar with if you are used to application server |
| clustering is a symmetric cluster.</p> |
| <p>With a symmetric cluster, the cluster is homogeneous, i.e. each node is |
| configured the same as every other node, and every node is connected to |
| every other node in the cluster.</p> |
| <h2 id="temporary-queue">Temporary Queue</h2> |
| <p>A simple example demonstrating how to use a JMS temporary queue.</p> |
| <h2 id="topic">Topic</h2> |
| <p>A simple example demonstrating a JMS topic.</p> |
| <h2 id="topic-hierarchy">Topic Hierarchy</h2> |
| <p>Apache ActiveMQ Artemis supports topic hierarchies. With a topic hierarchy you can |
| register a subscriber with a wild-card and that subscriber will receive |
| any messages sent to an address that matches the wild card.</p> |
| <h2 id="topic-selector-1">Topic Selector 1</h2> |
| <p>The <code>topic-selector-example1</code> example shows you how to send message to a |
| JMS Topic, and subscribe them using selectors with Apache ActiveMQ Artemis.</p> |
| <h2 id="topic-selector-2">Topic Selector 2</h2> |
| <p>The <code>topic-selector-example2</code> example shows you how to selectively |
| consume messages using message selectors with topic consumers.</p> |
| <h2 id="transaction-failover">Transaction Failover</h2> |
| <p>The <code>transaction-failover</code> example demonstrates two servers coupled as a |
| live-backup pair for high availability (HA), and a client using a |
| transacted JMS session failing over from live to backup when the live |
| server is crashed.</p> |
| <p>Apache ActiveMQ Artemis implements failover of client connections between live and |
| backup servers. This is implemented by the sharing of a journal between |
| the servers. When a live node crashes, the client connections can carry |
| and continue to send and consume messages. When transacted sessions are |
| used, once and only once message delivery is guaranteed.</p> |
| <h2 id="failover-without-transactions">Failover Without Transactions</h2> |
| <p>The <code>stop-server-failover</code> example demonstrates failover of the JMS |
| connection from one node to another when the live server crashes using a |
| JMS non-transacted session.</p> |
| <h2 id="transactional-session">Transactional Session</h2> |
| <p>The <code>transactional</code> example shows you how to use a transactional Session |
| with Apache ActiveMQ Artemis.</p> |
| <h2 id="xa-heuristic">XA Heuristic</h2> |
| <p>The <code>xa-heuristic</code> example shows you how to make an XA heuristic |
| decision through Apache ActiveMQ Artemis Management Interface. A heuristic decision is |
| a unilateral decision to commit or rollback an XA transaction branch |
| after it has been prepared.</p> |
| <h2 id="xa-receive">XA Receive</h2> |
| <p>The <code>xa-receive</code> example shows you how message receiving behaves in an |
| XA transaction in Apache ActiveMQ Artemis.</p> |
| <h2 id="xa-send">XA Send</h2> |
| <p>The <code>xa-send</code> example shows you how message sending behaves in an XA |
| transaction in Apache ActiveMQ Artemis.</p> |
| <h1 id="core-api-examples">Core API Examples</h1> |
| <p>To run a core example, simply <code>cd</code> into the appropriate example |
| directory and type <code>ant</code></p> |
| <h2 id="embedded">Embedded</h2> |
| <p>The <code>embedded</code> example shows how to embed the Apache ActiveMQ Artemis server within |
| your own code.</p> |
| |
| |
| </section> |
| |
| |
| </div> |
| </div> |
| </div> |
| |
| |
| <a href="./client-classpath.html" class="navigation navigation-prev " aria-label="Previous page: The Client Classpath"><i class="fa fa-angle-left"></i></a> |
| |
| |
| <a href="./wildcard-routing.html" class="navigation navigation-next " aria-label="Next page: Routing Messages With Wild Cards"><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> |