| |
| <!DOCTYPE HTML> |
| <html lang="" > |
| <head> |
| <title>STOMP ยท ActiveMQ Artemis Documentation</title> |
| <meta charset="UTF-8"> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> |
| <meta name="description" content=""> |
| <meta name="generator" content="GitBook 3.1.1"> |
| |
| |
| |
| |
| <link rel="stylesheet" href="gitbook/style.css"> |
| |
| |
| |
| |
| <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css"> |
| |
| |
| |
| <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css"> |
| |
| |
| |
| <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <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="next" href="openwire.html" /> |
| |
| |
| <link rel="prev" href="mqtt.html" /> |
| |
| |
| </head> |
| <body> |
| |
| <div class="book"> |
| <div class="book-summary"> |
| |
| |
| <div id="book-search-input" role="search"> |
| <input type="text" placeholder="Type to search" /> |
| </div> |
| |
| |
| <nav role="navigation"> |
| |
| |
| |
| <ul class="summary"> |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| <li class="chapter " data-level="1.1" data-path="./"> |
| |
| <a href="./"> |
| |
| |
| Introduction |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.2" data-path="notice.html"> |
| |
| <a href="notice.html"> |
| |
| |
| Legal Notice |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.3" data-path="preface.html"> |
| |
| <a href="preface.html"> |
| |
| |
| Preface |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.4" data-path="project-info.html"> |
| |
| <a href="project-info.html"> |
| |
| |
| Project Info |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.5" data-path="versions.html"> |
| |
| <a href="versions.html"> |
| |
| |
| Versions |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.6" data-path="messaging-concepts.html"> |
| |
| <a href="messaging-concepts.html"> |
| |
| |
| Messaging Concepts |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.7" data-path="architecture.html"> |
| |
| <a href="architecture.html"> |
| |
| |
| Architecture |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.8" data-path="using-server.html"> |
| |
| <a href="using-server.html"> |
| |
| |
| Using the Server |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.9" data-path="upgrading.html"> |
| |
| <a href="upgrading.html"> |
| |
| |
| Upgrading |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.10" data-path="address-model.html"> |
| |
| <a href="address-model.html"> |
| |
| |
| Address Model |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.11" data-path="protocols-interoperability.html"> |
| |
| <a href="protocols-interoperability.html"> |
| |
| |
| Protocols and Interoperability |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.12" data-path="amqp.html"> |
| |
| <a href="amqp.html"> |
| |
| |
| AMQP |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.13" data-path="mqtt.html"> |
| |
| <a href="mqtt.html"> |
| |
| |
| MQTT |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter active" data-level="1.14" data-path="stomp.html"> |
| |
| <a href="stomp.html"> |
| |
| |
| STOMP |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.15" data-path="openwire.html"> |
| |
| <a href="openwire.html"> |
| |
| |
| OpenWire |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.16" data-path="core.html"> |
| |
| <a href="core.html"> |
| |
| |
| Core |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.17" data-path="jms-core-mapping.html"> |
| |
| <a href="jms-core-mapping.html"> |
| |
| |
| Mapping JMS Concepts to the Core API |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.18" data-path="using-jms.html"> |
| |
| <a href="using-jms.html"> |
| |
| |
| Using JMS |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.19" data-path="client-classpath.html"> |
| |
| <a href="client-classpath.html"> |
| |
| |
| The Client Classpath |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.20" data-path="examples.html"> |
| |
| <a href="examples.html"> |
| |
| |
| Examples |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.21" data-path="wildcard-routing.html"> |
| |
| <a href="wildcard-routing.html"> |
| |
| |
| Routing Messages With Wild Cards |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.22" data-path="wildcard-syntax.html"> |
| |
| <a href="wildcard-syntax.html"> |
| |
| |
| Wildcard Syntax |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.23" data-path="filter-expressions.html"> |
| |
| <a href="filter-expressions.html"> |
| |
| |
| Filter Expressions |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.24" data-path="persistence.html"> |
| |
| <a href="persistence.html"> |
| |
| |
| Persistence |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.25" data-path="configuring-transports.html"> |
| |
| <a href="configuring-transports.html"> |
| |
| |
| Configuring Transports |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.26" data-path="config-reload.html"> |
| |
| <a href="config-reload.html"> |
| |
| |
| Configuration Reload |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.27" data-path="connection-ttl.html"> |
| |
| <a href="connection-ttl.html"> |
| |
| |
| Detecting Dead Connections |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.28" data-path="slow-consumers.html"> |
| |
| <a href="slow-consumers.html"> |
| |
| |
| Detecting Slow Consumers |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.29" data-path="network-isolation.html"> |
| |
| <a href="network-isolation.html"> |
| |
| |
| Avoiding Network Isolation |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.30" data-path="critical-analysis.html"> |
| |
| <a href="critical-analysis.html"> |
| |
| |
| Detecting Broker Issues (Critical Analysis) |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.31" data-path="transaction-config.html"> |
| |
| <a href="transaction-config.html"> |
| |
| |
| Resource Manager Configuration |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.32" data-path="flow-control.html"> |
| |
| <a href="flow-control.html"> |
| |
| |
| Flow Control |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.33" data-path="send-guarantees.html"> |
| |
| <a href="send-guarantees.html"> |
| |
| |
| Guarantees of sends and commits |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.34" data-path="undelivered-messages.html"> |
| |
| <a href="undelivered-messages.html"> |
| |
| |
| Message Redelivery and Undelivered Messages |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.35" data-path="message-expiry.html"> |
| |
| <a href="message-expiry.html"> |
| |
| |
| Message Expiry |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.36" data-path="large-messages.html"> |
| |
| <a href="large-messages.html"> |
| |
| |
| Large Messages |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.37" data-path="paging.html"> |
| |
| <a href="paging.html"> |
| |
| |
| Paging |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.38" data-path="scheduled-messages.html"> |
| |
| <a href="scheduled-messages.html"> |
| |
| |
| Scheduled Messages |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.39" data-path="last-value-queues.html"> |
| |
| <a href="last-value-queues.html"> |
| |
| |
| Last-Value Queues |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.40" data-path="ring-queues.html"> |
| |
| <a href="ring-queues.html"> |
| |
| |
| Ring Queues |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.41" data-path="retroactive-addresses.html"> |
| |
| <a href="retroactive-addresses.html"> |
| |
| |
| Retroactive Addresses |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.42" data-path="exclusive-queues.html"> |
| |
| <a href="exclusive-queues.html"> |
| |
| |
| Exclusive Queues |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.43" data-path="message-grouping.html"> |
| |
| <a href="message-grouping.html"> |
| |
| |
| Message Grouping |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.44" data-path="consumer-priority.html"> |
| |
| <a href="consumer-priority.html"> |
| |
| |
| Consumer Priority |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.45" data-path="pre-acknowledge.html"> |
| |
| <a href="pre-acknowledge.html"> |
| |
| |
| Extra Acknowledge Modes |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.46" data-path="management.html"> |
| |
| <a href="management.html"> |
| |
| |
| Management |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.47" data-path="management-console.html"> |
| |
| <a href="management-console.html"> |
| |
| |
| Management Console |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.48" data-path="metrics.html"> |
| |
| <a href="metrics.html"> |
| |
| |
| Metrics |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.49" data-path="security.html"> |
| |
| <a href="security.html"> |
| |
| |
| Security |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.50" data-path="masking-passwords.html"> |
| |
| <a href="masking-passwords.html"> |
| |
| |
| Masking Passwords |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.51" data-path="broker-plugins.html"> |
| |
| <a href="broker-plugins.html"> |
| |
| |
| Broker Plugins |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.52" data-path="resource-limits.html"> |
| |
| <a href="resource-limits.html"> |
| |
| |
| Resource Limits |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.53" data-path="jms-bridge.html"> |
| |
| <a href="jms-bridge.html"> |
| |
| |
| The JMS Bridge |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.54" data-path="client-reconnection.html"> |
| |
| <a href="client-reconnection.html"> |
| |
| |
| Client Reconnection and Session Reattachment |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.55" data-path="diverts.html"> |
| |
| <a href="diverts.html"> |
| |
| |
| Diverting and Splitting Message Flows |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.56" data-path="core-bridges.html"> |
| |
| <a href="core-bridges.html"> |
| |
| |
| Core Bridges |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.57" data-path="transformers.html"> |
| |
| <a href="transformers.html"> |
| |
| |
| Transformers |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.58" data-path="duplicate-detection.html"> |
| |
| <a href="duplicate-detection.html"> |
| |
| |
| Duplicate Message Detection |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.59" data-path="clusters.html"> |
| |
| <a href="clusters.html"> |
| |
| |
| Clusters |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.60" data-path="federation.html"> |
| |
| <a href="federation.html"> |
| |
| |
| Federation |
| |
| </a> |
| |
| |
| |
| <ul class="articles"> |
| |
| |
| <li class="chapter " data-level="1.60.1" data-path="federation-address.html"> |
| |
| <a href="federation-address.html"> |
| |
| |
| Address Federation |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.60.2" data-path="federation-queue.html"> |
| |
| <a href="federation-queue.html"> |
| |
| |
| Queue Federation |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| |
| </ul> |
| |
| </li> |
| |
| <li class="chapter " data-level="1.61" data-path="ha.html"> |
| |
| <a href="ha.html"> |
| |
| |
| High Availability and Failover |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.62" data-path="graceful-shutdown.html"> |
| |
| <a href="graceful-shutdown.html"> |
| |
| |
| Graceful Server Shutdown |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.63" data-path="libaio.html"> |
| |
| <a href="libaio.html"> |
| |
| |
| Libaio Native Libraries |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.64" data-path="thread-pooling.html"> |
| |
| <a href="thread-pooling.html"> |
| |
| |
| Thread management |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.65" data-path="web-server.html"> |
| |
| <a href="web-server.html"> |
| |
| |
| Embedded Web Server |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.66" data-path="logging.html"> |
| |
| <a href="logging.html"> |
| |
| |
| Logging |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.67" data-path="rest.html"> |
| |
| <a href="rest.html"> |
| |
| |
| REST Interface |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.68" data-path="embedding-activemq.html"> |
| |
| <a href="embedding-activemq.html"> |
| |
| |
| Embedding the Broker |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.69" data-path="karaf.html"> |
| |
| <a href="karaf.html"> |
| |
| |
| Apache Karaf |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.70" data-path="tomcat.html"> |
| |
| <a href="tomcat.html"> |
| |
| |
| Apache Tomcat |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.71" data-path="spring-integration.html"> |
| |
| <a href="spring-integration.html"> |
| |
| |
| Spring Integration |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.72" data-path="cdi-integration.html"> |
| |
| <a href="cdi-integration.html"> |
| |
| |
| CDI Integration |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.73" data-path="intercepting-operations.html"> |
| |
| <a href="intercepting-operations.html"> |
| |
| |
| Intercepting Operations |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.74" data-path="data-tools.html"> |
| |
| <a href="data-tools.html"> |
| |
| |
| Data Tools |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.75" data-path="maven-plugin.html"> |
| |
| <a href="maven-plugin.html"> |
| |
| |
| Maven Plugin |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.76" data-path="unit-testing.html"> |
| |
| <a href="unit-testing.html"> |
| |
| |
| Unit Testing |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.77" data-path="perf-tuning.html"> |
| |
| <a href="perf-tuning.html"> |
| |
| |
| Troubleshooting and Performance Tuning |
| |
| </a> |
| |
| |
| |
| </li> |
| |
| <li class="chapter " data-level="1.78" data-path="configuration-index.html"> |
| |
| <a href="configuration-index.html"> |
| |
| |
| 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> |
| |
| |
| </nav> |
| |
| |
| </div> |
| |
| <div class="book-body"> |
| |
| <div class="body-inner"> |
| |
| |
| |
| <div class="book-header" role="navigation"> |
| |
| |
| <!-- Title --> |
| <h1> |
| <i class="fa fa-circle-o-notch fa-spin"></i> |
| <a href="." >STOMP</a> |
| </h1> |
| </div> |
| |
| |
| |
| |
| <div class="page-wrapper" tabindex="-1" role="main"> |
| <div class="page-inner"> |
| |
| <div id="book-search-results"> |
| <div class="search-noresults"> |
| |
| <section class="normal markdown-section"> |
| |
| <h1 id="stomp">STOMP</h1> |
| <p><a href="https://stomp.github.io/" target="_blank">STOMP</a> is a text-orientated wire protocol that |
| allows STOMP clients to communicate with STOMP Brokers. Apache ActiveMQ Artemis |
| supports STOMP 1.0, 1.1 and 1.2.</p> |
| <p>STOMP clients are available for several languages and platforms making it a |
| good choice for interoperability.</p> |
| <p>By default there are <code>acceptor</code> elements configured to accept STOMP connections |
| on ports <code>61616</code> and <code>61613</code>.</p> |
| <p>See the general <a href="protocols-interoperability.html">Protocols and Interoperability</a> |
| chapter for details on configuring an <code>acceptor</code> for STOMP.</p> |
| <p>Refer to the STOMP examples for a look at some of this functionality in action.</p> |
| <h2 id="limitations">Limitations</h2> |
| <p>The STOMP specification identifies <strong>transactional acknowledgements</strong> as an |
| optional feature. Support for transactional acknowledgements is not implemented |
| in Apache ActiveMQ Artemis. The <code>ACK</code> frame can not be part of a transaction. |
| It will be ignored if its <code>transaction</code> header is set.</p> |
| <h2 id="virtual-hosting">Virtual Hosting</h2> |
| <p>Apache ActiveMQ Artemis currently doesn't support virtual hosting, which means |
| the <code>host</code> header in <code>CONNECT</code> frame will be ignored.</p> |
| <h2 id="mapping-stomp-destinations-to-addresses-and-queues">Mapping STOMP destinations to addresses and queues</h2> |
| <p>STOMP clients deals with <em>destinations</em> when sending messages and subscribing. |
| Destination names are simply strings which are mapped to some form of |
| destination on the server - how the server translates these is left to the |
| server implementation.</p> |
| <p>In Apache ActiveMQ Artemis, these destinations are mapped to <em>addresses</em> and |
| <em>queues</em> depending on the operation being done and the desired semantics (e.g. |
| anycast or multicast).</p> |
| <h2 id="logging">Logging</h2> |
| <p>Incoming and outgoing STOMP frames can be logged by enabling <code>DEBUG</code> for |
| <code>org.apache.activemq.artemis.core.protocol.stomp.StompConnection</code>. This can be |
| extremely useful for debugging or simply monitoring client activity. Along with |
| the STOMP frame itself the remote IP address of the client is logged as well as |
| the internal connection ID so that frames from the same client can be correlated.</p> |
| <h2 id="routing-semantics">Routing Semantics</h2> |
| <p>The STOMP specification is intentionally ambiguous about message routing |
| semantics. When providing an overview of the protocol the STOMP 1.2 specification |
| <a href="https://stomp.github.io/stomp-specification-1.2.html#Protocol_Overview" target="_blank">says</a>:</p> |
| <pre><code>A STOMP server is modelled as a set of destinations to which messages can be sent. |
| The STOMP protocol treats destinations as opaque string and their syntax is |
| server implementation specific. Additionally STOMP does not define what the |
| delivery semantics of destinations should be. The delivery, or |
| "message exchange", semantics of destinations can vary from server to server and |
| even from destination to destination. This allows servers to be creative with the |
| semantics that they can support with STOMP. |
| </code></pre><p>Therefore, there are a handful of different ways to specify which semantics are |
| desired both on the client-side and broker-side.</p> |
| <h3 id="configuring-routing-semantics-from-the-client-side">Configuring Routing Semantics from the Client Side</h3> |
| <h4 id="sending">Sending</h4> |
| <p>When a STOMP client sends a message (using a <code>SEND</code> frame), the protocol |
| manager looks at the <code>destination-type</code> header to determine where to route |
| it and potentially how to create the address and/or queue to which it is |
| being sent. Valid values are <code>ANYCAST</code> and <code>MULTICAST</code> (case sensitive). |
| If no indication of routing type is supplied (either by the client or the |
| broker) then the default defined in the corresponding |
| <code>default-address-routing-type</code> & <code>default-queue-routing-type</code> |
| address-settings will be used as necessary.</p> |
| <p>The <code>destination</code> header maps to an address of the same name if <code>MULTICAST</code> is |
| used and additionally to a queue of the same name if <code>ANYCAST</code> is used.</p> |
| <h4 id="subscribing">Subscribing</h4> |
| <p>When a STOMP client subscribes to a destination (using a <code>SUBSCRIBE</code> frame), |
| the protocol manager looks at the <code>subscription-type</code> header frame to determine |
| what subscription semantics to use and potentially how to create the address |
| and/or queue for the subscription. If no indication of routing type is |
| supplied (either by the client or the broker) then the default defined in the |
| corresponding <code>default-address-routing-type</code> & <code>default-queue-routing-type</code> |
| address-settings will be used as necessary.</p> |
| <p>The <code>destination</code> header maps to an address of the same name if <code>MULTICAST</code> is |
| used and additionally to a queue of the same name if <code>ANYCAST</code> is used.</p> |
| <h3 id="configuring-routing-semantics-from-the-broker-side">Configuring Routing Semantics from the Broker side</h3> |
| <p>On the broker-side there are two main options for specifying routing semantics - |
| prefixes and address settings</p> |
| <h4 id="prefixes">Prefixes</h4> |
| <p>Using prefixes involves specifying the <code>anycastPrefix</code> and/or the |
| <code>multicastPrefix</code> on the acceptor which the STOMP client is using. For the STOMP |
| use-case these prefixes tell the broker that destinations using them should be |
| treated as anycast or multicast. For example, if the acceptor has |
| <code>anycastPrefix=queue/</code> then when a STOMP client sends a message to |
| <code>destination:queue/foo</code> the broker will auto-create the address <code>foo</code> and queue |
| <code>foo</code> appropriately as anycast and the message will be placed in that queue. |
| Additionally, if the acceptor has <code>multicastPrefix=topic/</code> then when a STOMP |
| client sends a message to <code>destination:topic/bar</code> the broker will auto-create |
| the address bar as multicast, but it won't create a queue since multicast |
| (i.e. pub/sub) semantics require a client to explicitly create a subscription |
| to receive those messages.</p> |
| <p>Note: The <code>anycastPrefix</code> and/or <code>multicastPrefix</code> on the acceptor will be |
| stripped from the <code>destination</code> value.</p> |
| <h4 id="address-settings">Address Settings</h4> |
| <p>Using address settings involves defining address-setting elements whose <code>match</code> |
| corresponds with the destination names the clients will use along with the proper |
| <code>delimiter</code> to enabled matching. For example, broker.xml could use the following:</p> |
| <pre><code class="lang-xml"><span class="hljs-tag"><<span class="hljs-name">address-settings</span>></span> |
| <span class="hljs-tag"><<span class="hljs-name">address-setting</span> <span class="hljs-attr">match</span>=<span class="hljs-string">"queue/#"</span>></span> |
| <span class="hljs-tag"><<span class="hljs-name">default-address-routing-type</span>></span>ANYCAST<span class="hljs-tag"></<span class="hljs-name">default-address-routing-type</span>></span> |
| <span class="hljs-tag"><<span class="hljs-name">default-queue-routing-type</span>></span>ANYCAST<span class="hljs-tag"></<span class="hljs-name">default-queue-routing-type</span>></span> |
| <span class="hljs-tag"></<span class="hljs-name">address</span>></span> |
| <span class="hljs-tag"><<span class="hljs-name">address-setting</span> <span class="hljs-attr">match</span>=<span class="hljs-string">"topic/#"</span>></span> |
| <span class="hljs-tag"><<span class="hljs-name">default-address-routing-type</span>></span>MULTICAST<span class="hljs-tag"></<span class="hljs-name">default-address-routing-type</span>></span> |
| <span class="hljs-tag"><<span class="hljs-name">default-queue-routing-type</span>></span>MULTICAST<span class="hljs-tag"></<span class="hljs-name">default-queue-routing-type</span>></span> |
| <span class="hljs-tag"></<span class="hljs-name">address</span>></span> |
| <span class="hljs-tag"></<span class="hljs-name">address-settings</span>></span> |
| <span class="hljs-tag"><<span class="hljs-name">wildcard-addresses</span>></span> |
| <span class="hljs-tag"><<span class="hljs-name">delimiter</span>></span>/<span class="hljs-tag"></<span class="hljs-name">delimiter</span>></span> |
| <span class="hljs-tag"></<span class="hljs-name">wildcard-addresses</span>></span> |
| </code></pre> |
| <p>Then if a STOMP client sends a message to <code>destination:queue/foo</code> the broker will |
| auto-create the address <code>queue/foo</code> and queue <code>queue/foo</code> appropriately as |
| anycast and the message will be placed in that queue. Additionally, if a STOMP |
| client sends a message to <code>destination:topic/bar</code> the broker will auto-create the |
| address <code>topic/bar</code> as multicast, but it won't create a queue as previously |
| explained.</p> |
| <h2 id="stomp-heart-beating-and-connection-ttl">STOMP heart-beating and connection-ttl</h2> |
| <p>Well behaved STOMP clients will always send a <code>DISCONNECT</code> frame before closing |
| their connections. In this case the server will clear up any server side |
| resources such as sessions and consumers synchronously. However if STOMP |
| clients exit without sending a <code>DISCONNECT</code> frame or if they crash the server |
| will have no way of knowing immediately whether the client is still alive or |
| not. STOMP connections therefore default to a <code>connection-ttl</code> value of 1 |
| minute (see chapter on <a href="connection-ttl.html">connection-ttl</a> for more |
| information. This value can be overridden using the <code>connection-ttl-override</code> |
| property or if you need a specific connectionTtl for your stomp connections |
| without affecting the broker-wide <code>connection-ttl-override</code> setting, you can |
| configure your stomp acceptor with the <code>connectionTtl</code> property, which is used |
| to set the ttl for connections that are created from that acceptor. For |
| example:</p> |
| <pre><code class="lang-xml"><span class="hljs-tag"><<span class="hljs-name">acceptor</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"stomp-acceptor"</span>></span>tcp://localhost:61613?protocols=STOMP;connectionTtl=20000<span class="hljs-tag"></<span class="hljs-name">acceptor</span>></span> |
| </code></pre> |
| <p>The above configuration will make sure that any STOMP connection that is |
| created from that acceptor and does not include a <code>heart-beat</code> header or |
| disables client-to-server heart-beats by specifying a <code>0</code> value will have its |
| <code>connection-ttl</code> set to 20 seconds. The <code>connectionTtl</code> set on an acceptor will |
| take precedence over <code>connection-ttl-override</code>. The default <code>connectionTtl</code> is |
| 60,000 milliseconds.</p> |
| <p>Since STOMP 1.0 does not support heart-beating then all connections from STOMP |
| 1.0 clients will have a connection TTL imposed upon them by the broker based on |
| the aforementioned configuration options. Likewise, any STOMP 1.1 or 1.2 |
| clients that don't specify a <code>heart-beat</code> header or disable client-to-server |
| heart-beating (e.g. by sending <code>0,X</code> in the <code>heart-beat</code> header) will have a |
| connection TTL imposed upon them by the broker.</p> |
| <p>For STOMP 1.1 and 1.2 clients which send a non-zero client-to-server |
| <code>heart-beat</code> header value then their connection TTL will be set accordingly. |
| However, the broker will not strictly set the connection TTL to the same value |
| as the specified in the <code>heart-beat</code> since even small network delays could then |
| cause spurious disconnects. Instead, the client-to-server value in the |
| <code>heart-beat</code> will be multiplied by the <code>heartBeatToConnectionTtlModifier</code> |
| specified on the acceptor. The <code>heartBeatToConnectionTtlModifier</code> is a decimal |
| value that defaults to <code>2.0</code> so for example, if a client sends a <code>heart-beat</code> |
| header of <code>1000,0</code> the the connection TTL will be set to <code>2000</code> so that the |
| data or ping frames sent every 1000 milliseconds will have a sufficient cushion |
| so as not to be considered late and trigger a disconnect. This is also in |
| accordance with the STOMP 1.1 and 1.2 specifications which both state, "because |
| of timing inaccuracies, the receiver SHOULD be tolerant and take into account |
| an error margin."</p> |
| <p>The minimum and maximum connection TTL allowed can also be specified on the |
| acceptor via the <code>connectionTtlMin</code> and <code>connectionTtlMax</code> properties |
| respectively. The default <code>connectionTtlMin</code> is 1000 and the default |
| <code>connectionTtlMax</code> is Java's <code>Long.MAX_VALUE</code> meaning there essentially is no |
| max connection TTL by default. Keep in mind that the |
| <code>heartBeatToConnectionTtlModifier</code> is relevant here. For example, if a client |
| sends a <code>heart-beat</code> header of <code>20000,0</code> and the acceptor is using a |
| <code>connectionTtlMax</code> of <code>30000</code> and a default <code>heartBeatToConnectionTtlModifier</code> of |
| <code>2.0</code> then the connection TTL would be <code>40000</code> (i.e. <code>20000</code> * <code>2.0</code>) which |
| would exceed the <code>connectionTtlMax</code>. In this case the server would respond to |
| the client with a <code>heart-beat</code> header of <code>0,15000</code> (i.e. <code>30000</code> / <code>2.0</code>). As |
| described previously, this is to make sure there is a sufficient cushion for |
| the client heart-beats in accordance with the STOMP 1.1 and 1.2 specifications. |
| The same kind of calculation is done for <code>connectionTtlMin</code>.</p> |
| <p>The minimum server-to-client heart-beat value is 500ms.</p> |
| <blockquote> |
| <p><strong>Note:</strong></p> |
| <p>Please note that the STOMP protocol version 1.0 does not contain any |
| heart-beat frame. It is therefore the user's responsibility to make sure data |
| is sent within connection-ttl or the server will assume the client is dead |
| and clean up server side resources. With STOMP 1.1 users can use heart-beats |
| to maintain the life cycle of stomp connections.</p> |
| </blockquote> |
| <h2 id="selectorfilter-expressions">Selector/Filter expressions</h2> |
| <p>STOMP subscribers can specify an expression used to select or filter what the |
| subscriber receives using the <code>selector</code> header. The filter expression syntax |
| follows the <em>core filter syntax</em> described in the <a href="filter-expressions.html">Filter |
| Expressions</a> documentation.</p> |
| <h2 id="stomp-and-jms-interoperability">STOMP and JMS interoperability</h2> |
| <h3 id="sending-and-consuming-stomp-message-from-jms-or-core-api">Sending and consuming STOMP message from JMS or Core API</h3> |
| <p>STOMP is mainly a text-orientated protocol. To make it simpler to interoperate |
| with JMS and Core API, our STOMP implementation checks for presence of the |
| <code>content-length</code> header to decide how to map a STOMP 1.0 message to a JMS |
| Message or a Core message.</p> |
| <p>If the STOMP 1.0 message does <em>not</em> have a <code>content-length</code> header, it will be |
| mapped to a JMS <em>TextMessage</em> or a Core message with a <em>single nullable |
| SimpleString in the body buffer</em>.</p> |
| <p>Alternatively, if the STOMP 1.0 message <em>has</em> a <code>content-length</code> header, it |
| will be mapped to a JMS <em>BytesMessage</em> or a Core message with a <em>byte[] in the |
| body buffer</em>.</p> |
| <p>The same logic applies when mapping a JMS message or a Core message to STOMP. A |
| STOMP 1.0 client can check the presence of the <code>content-length</code> header to |
| determine the type of the message body (String or bytes).</p> |
| <h3 id="message-ids-for-stomp-messages">Message IDs for STOMP messages</h3> |
| <p>When receiving STOMP messages via a JMS consumer or a QueueBrowser, the |
| messages have no properties like JMSMessageID by default. However this may |
| bring some inconvenience to clients who wants an ID for their purpose. The |
| broker STOMP provides a parameter to enable message ID on each incoming STOMP |
| message. If you want each STOMP message to have a unique ID, just set the |
| <code>stompEnableMessageId</code> to true. For example:</p> |
| <pre><code class="lang-xml"><span class="hljs-tag"><<span class="hljs-name">acceptor</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"stomp-acceptor"</span>></span>tcp://localhost:61613?protocols=STOMP;stompEnableMessageId=true<span class="hljs-tag"></<span class="hljs-name">acceptor</span>></span> |
| </code></pre> |
| <p>When the server starts with the above setting, each stomp message sent through |
| this acceptor will have an extra property added. The property key is |
| <code>amqMessageId</code> and the value is a String representation of a long type |
| internal message id prefixed with <code>STOMP</code>, like:</p> |
| <pre><code>amqMessageId : STOMP12345 |
| </code></pre><p>The default <code>stompEnableMessageId</code> value is <code>false</code>.</p> |
| <h2 id="durable-subscriptions">Durable Subscriptions</h2> |
| <p>The <code>SUBSCRIBE</code> and <code>UNSUBSCRIBE</code> frames can be augmented with special headers |
| to create and destroy durable subscriptions respectively.</p> |
| <p>To create a durable subscription the <code>client-id</code> header must be set on the |
| <code>CONNECT</code> frame and the <code>durable-subscription-name</code> must be set on the |
| <code>SUBSCRIBE</code> frame. The combination of these two headers will form the identity |
| of the durable subscription.</p> |
| <p>To delete a durable subscription the <code>client-id</code> header must be set on the |
| <code>CONNECT</code> frame and the <code>durable-subscription-name</code> must be set on the |
| <code>UNSUBSCRIBE</code> frame. The values for these headers should match what was set on |
| the <code>SUBSCRIBE</code> frame to delete the corresponding durable subscription.</p> |
| <p>Aside from <code>durable-subscription-name</code>, the broker also supports |
| <code>durable-subscriber-name</code> (a deprecated property used before |
| <code>durable-subscription-name</code>) as well as <code>activemq.subscriptionName</code> from ActiveMQ |
| 5.x. This is the order of precedence if the frame contains more than one of these:</p> |
| <p>1) <code>durable-subscriber-name</code> |
| 2) <code>durable-subscription-name</code> |
| 3) <code>activemq.subscriptionName</code></p> |
| <p>It is possible to pre-configure durable subscriptions since the STOMP |
| implementation creates the queue used for the durable subscription in a |
| deterministic way (i.e. using the format of <code>client-id</code>.<code>subscription-name</code>). |
| For example, if you wanted to configure a durable subscription on the address |
| <code>myAddress</code> with a client-id of <code>myclientid</code> and a subscription name of |
| <code>mysubscription</code> then configure the durable subscription:</p> |
| <pre><code class="lang-xml"><span class="hljs-tag"><<span class="hljs-name">addresses</span>></span> |
| <span class="hljs-tag"><<span class="hljs-name">address</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"myAddress"</span>></span> |
| <span class="hljs-tag"><<span class="hljs-name">multicast</span>></span> |
| <span class="hljs-tag"><<span class="hljs-name">queue</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"myclientid.mysubscription"</span>/></span> |
| <span class="hljs-tag"></<span class="hljs-name">multicast</span>></span> |
| <span class="hljs-tag"></<span class="hljs-name">address</span>></span> |
| <span class="hljs-tag"></<span class="hljs-name">addresses</span>></span> |
| </code></pre> |
| <h2 id="handling-of-large-messages-with-stomp">Handling of Large Messages with STOMP</h2> |
| <p>STOMP clients may send very large frame bodies which can exceed the size of the |
| broker's internal buffer, causing unexpected errors. To prevent this situation |
| from happening, the broker provides a STOMP configuration attribute |
| <code>stompMinLargeMessageSize</code>. This attribute can be configured inside a stomp |
| acceptor, as a parameter. For example:</p> |
| <pre><code class="lang-xml"><span class="hljs-tag"><<span class="hljs-name">acceptor</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"stomp-acceptor"</span>></span>tcp://localhost:61613?protocols=STOMP;stompMinLargeMessageSize=10240<span class="hljs-tag"></<span class="hljs-name">acceptor</span>></span> |
| </code></pre> |
| <p>The type of this attribute is integer. When this attributed is configured, the |
| broker will check the size of the body of each STOMP frame arrived from |
| connections established with this acceptor. If the size of the body is equal or |
| greater than the value of <code>stompMinLargeMessageSize</code>, the message will be |
| persisted as a large message. When a large message is delievered to a STOMP |
| consumer, the broker will automatically handle the conversion from a large |
| message to a normal message, before sending it to the client.</p> |
| <p>If a large message is compressed, the server will uncompressed it before |
| sending it to stomp clients. The default value of <code>stompMinLargeMessageSize</code> is |
| the same as the default value of |
| <a href="large-messages.html#configuring-parameters">minLargeMessageSize</a>.</p> |
| <h2 id="web-sockets">Web Sockets</h2> |
| <p>Apache ActiveMQ Artemis also supports STOMP over <a href="https://html.spec.whatwg.org/multipage/web-sockets.html" target="_blank">Web |
| Sockets</a>. Modern web |
| browsers which support Web Sockets can send and receive STOMP messages.</p> |
| <p>STOMP over Web Sockets is supported via the normal STOMP acceptor:</p> |
| <pre><code class="lang-xml"><span class="hljs-tag"><<span class="hljs-name">acceptor</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"stomp-ws-acceptor"</span>></span>tcp://localhost:61614?protocols=STOMP<span class="hljs-tag"></<span class="hljs-name">acceptor</span>></span> |
| </code></pre> |
| <p>With this configuration, Apache ActiveMQ Artemis will accept STOMP connections |
| over Web Sockets on the port <code>61614</code>. Web browsers can then connect to |
| <code>ws://<server>:61614</code> using a Web Socket to send and receive STOMP messages.</p> |
| <p>A companion JavaScript library to ease client-side development is available |
| from <a href="https://github.com/jmesnil/stomp-websocket" target="_blank">GitHub</a> (please see its |
| <a href="http://jmesnil.net/stomp-websocket/doc/" target="_blank">documentation</a> for a complete |
| description).</p> |
| <p>The payload length of Web Socket frames can vary between client |
| implementations. By default the broker will accept frames with a payload length |
| of 65,536. If the client needs to send payloads longer than this in a single |
| frame this length can be adjusted by using the <code>stompMaxFramePayloadLength</code> URL |
| parameter on the acceptor.</p> |
| <p>The <code>stomp-websockets</code> example shows how to configure an Apache ActiveMQ |
| Artemis broker to have web browsers and Java applications exchanges messages.</p> |
| |
| |
| </section> |
| |
| </div> |
| <div class="search-results"> |
| <div class="has-results"> |
| |
| <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1> |
| <ul class="search-results-list"></ul> |
| |
| </div> |
| <div class="no-results"> |
| |
| <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1> |
| |
| </div> |
| </div> |
| </div> |
| |
| </div> |
| </div> |
| |
| </div> |
| |
| |
| |
| <a href="mqtt.html" class="navigation navigation-prev " aria-label="Previous page: MQTT"> |
| <i class="fa fa-angle-left"></i> |
| </a> |
| |
| |
| <a href="openwire.html" class="navigation navigation-next " aria-label="Next page: OpenWire"> |
| <i class="fa fa-angle-right"></i> |
| </a> |
| |
| |
| |
| </div> |
| |
| <script> |
| var gitbook = gitbook || []; |
| gitbook.push(function() { |
| gitbook.page.hasChanged({"page":{"title":"STOMP","level":"1.14","depth":1,"next":{"title":"OpenWire","level":"1.15","depth":1,"path":"openwire.md","ref":"openwire.md","articles":[]},"previous":{"title":"MQTT","level":"1.13","depth":1,"path":"mqtt.md","ref":"mqtt.md","articles":[]},"dir":"ltr"},"config":{"plugins":[],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"github":"apache/activemq-artemis","theme":"default","githubHost":"https://github.com/","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"ActiveMQ Artemis Documentation","links":{"home":"http://activemq.apache.org/artemis","issues":"https://issues.apache.org/jira/browse/ARTEMIS","contribute":"http://activemq.apache.org/contributing.html"},"gitbook":"3.x.x","description":"ActiveMQ Artemis User Guide and Reference Documentation"},"file":{"path":"stomp.md","mtime":"2020-04-27T19:30:24.000Z","type":"markdown"},"gitbook":{"version":"3.1.1","time":"2020-04-29T20:47:49.444Z"},"basePath":".","book":{"language":""}}); |
| }); |
| </script> |
| </div> |
| |
| |
| <script src="gitbook/gitbook.js"></script> |
| <script src="gitbook/theme.js"></script> |
| |
| |
| <script src="gitbook/gitbook-plugin-search/search-engine.js"></script> |
| |
| |
| |
| <script src="gitbook/gitbook-plugin-search/search.js"></script> |
| |
| |
| |
| <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script> |
| |
| |
| |
| <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script> |
| |
| |
| |
| <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script> |
| |
| |
| |
| <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script> |
| |
| |
| |
| </body> |
| </html> |
| |