blob: 777a0410f40dcfdef977d362337813b95e6c93c4 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="" >
<head>
<title>Queue Attributes ยท 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="scheduled-messages.html" />
<link rel="prev" href="paging.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="messaging-concepts.html">
<a href="messaging-concepts.html">
Messaging Concepts
</a>
</li>
<li class="chapter " data-level="1.6" data-path="architecture.html">
<a href="architecture.html">
Architecture
</a>
</li>
<li class="chapter " data-level="1.7" data-path="using-server.html">
<a href="using-server.html">
Using the Server
</a>
</li>
<li class="chapter " data-level="1.8" data-path="using-jms.html">
<a href="using-jms.html">
Using JMS
</a>
</li>
<li class="chapter " data-level="1.9" data-path="using-core.html">
<a href="using-core.html">
Using Core
</a>
</li>
<li class="chapter " data-level="1.10" 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.11" data-path="client-classpath.html">
<a href="client-classpath.html">
The Client Classpath
</a>
</li>
<li class="chapter " data-level="1.12" data-path="examples.html">
<a href="examples.html">
Examples
</a>
</li>
<li class="chapter " data-level="1.13" data-path="wildcard-routing.html">
<a href="wildcard-routing.html">
Routing Messages With Wild Cards
</a>
</li>
<li class="chapter " data-level="1.14" data-path="wildcard-syntax.html">
<a href="wildcard-syntax.html">
Understanding the Apache ActiveMQ Artemis Wildcard Syntax
</a>
</li>
<li class="chapter " data-level="1.15" data-path="filter-expressions.html">
<a href="filter-expressions.html">
Filter Expressions
</a>
</li>
<li class="chapter " data-level="1.16" data-path="persistence.html">
<a href="persistence.html">
Persistence
</a>
</li>
<li class="chapter " data-level="1.17" data-path="configuring-transports.html">
<a href="configuring-transports.html">
Configuring Transports
</a>
</li>
<li class="chapter " data-level="1.18" data-path="config-reload.html">
<a href="config-reload.html">
Configuration Reload
</a>
</li>
<li class="chapter " data-level="1.19" data-path="connection-ttl.html">
<a href="connection-ttl.html">
Detecting Dead Connections
</a>
</li>
<li class="chapter " data-level="1.20" data-path="slow-consumers.html">
<a href="slow-consumers.html">
Detecting Slow Consumers
</a>
</li>
<li class="chapter " data-level="1.21" data-path="network-isolation.html">
<a href="network-isolation.html">
Avoiding Network Isolation
</a>
</li>
<li class="chapter " data-level="1.22" data-path="transaction-config.html">
<a href="transaction-config.html">
Resource Manager Configuration
</a>
</li>
<li class="chapter " data-level="1.23" data-path="flow-control.html">
<a href="flow-control.html">
Flow Control
</a>
</li>
<li class="chapter " data-level="1.24" data-path="send-guarantees.html">
<a href="send-guarantees.html">
Guarantees of sends and commits
</a>
</li>
<li class="chapter " data-level="1.25" data-path="undelivered-messages.html">
<a href="undelivered-messages.html">
Message Redelivery and Undelivered Messages
</a>
</li>
<li class="chapter " data-level="1.26" data-path="message-expiry.html">
<a href="message-expiry.html">
Message Expiry
</a>
</li>
<li class="chapter " data-level="1.27" data-path="large-messages.html">
<a href="large-messages.html">
Large Messages
</a>
</li>
<li class="chapter " data-level="1.28" data-path="paging.html">
<a href="paging.html">
Paging
</a>
</li>
<li class="chapter active" data-level="1.29" data-path="queue-attributes.html">
<a href="queue-attributes.html">
Queue Attributes
</a>
</li>
<li class="chapter " data-level="1.30" data-path="scheduled-messages.html">
<a href="scheduled-messages.html">
Scheduled Messages
</a>
</li>
<li class="chapter " data-level="1.31" data-path="last-value-queues.html">
<a href="last-value-queues.html">
Last-Value Queues
</a>
</li>
<li class="chapter " data-level="1.32" data-path="message-grouping.html">
<a href="message-grouping.html">
Message Grouping
</a>
</li>
<li class="chapter " data-level="1.33" data-path="pre-acknowledge.html">
<a href="pre-acknowledge.html">
Extra Acknowledge Modes
</a>
</li>
<li class="chapter " data-level="1.34" data-path="management.html">
<a href="management.html">
Management
</a>
</li>
<li class="chapter " data-level="1.35" data-path="security.html">
<a href="security.html">
Security
</a>
</li>
<li class="chapter " data-level="1.36" data-path="resource-limits.html">
<a href="resource-limits.html">
Resource Limits
</a>
</li>
<li class="chapter " data-level="1.37" data-path="jms-bridge.html">
<a href="jms-bridge.html">
The JMS Bridge
</a>
</li>
<li class="chapter " data-level="1.38" data-path="client-reconnection.html">
<a href="client-reconnection.html">
Client Reconnection and Session Reattachment
</a>
</li>
<li class="chapter " data-level="1.39" data-path="diverts.html">
<a href="diverts.html">
Diverting and Splitting Message Flows
</a>
</li>
<li class="chapter " data-level="1.40" data-path="core-bridges.html">
<a href="core-bridges.html">
Core Bridges
</a>
</li>
<li class="chapter " data-level="1.41" data-path="duplicate-detection.html">
<a href="duplicate-detection.html">
Duplicate Message Detection
</a>
</li>
<li class="chapter " data-level="1.42" data-path="clusters.html">
<a href="clusters.html">
Clusters
</a>
</li>
<li class="chapter " data-level="1.43" data-path="ha.html">
<a href="ha.html">
High Availability and Failover
</a>
</li>
<li class="chapter " data-level="1.44" data-path="graceful-shutdown.html">
<a href="graceful-shutdown.html">
Graceful Server Shutdown
</a>
</li>
<li class="chapter " data-level="1.45" data-path="libaio.html">
<a href="libaio.html">
Libaio Native Libraries
</a>
</li>
<li class="chapter " data-level="1.46" data-path="thread-pooling.html">
<a href="thread-pooling.html">
Thread management
</a>
</li>
<li class="chapter " data-level="1.47" data-path="logging.html">
<a href="logging.html">
Logging
</a>
</li>
<li class="chapter " data-level="1.48" data-path="rest.html">
<a href="rest.html">
REST Interface
</a>
</li>
<li class="chapter " data-level="1.49" data-path="embedding-activemq.html">
<a href="embedding-activemq.html">
Embedding Apache ActiveMQ Artemis
</a>
</li>
<li class="chapter " data-level="1.50" data-path="karaf.html">
<a href="karaf.html">
Apache Karaf
</a>
</li>
<li class="chapter " data-level="1.51" data-path="spring-integration.html">
<a href="spring-integration.html">
Spring Integration
</a>
</li>
<li class="chapter " data-level="1.52" data-path="aerogear-integration.html">
<a href="aerogear-integration.html">
AeroGear Integration
</a>
</li>
<li class="chapter " data-level="1.53" data-path="vertx-integration.html">
<a href="vertx-integration.html">
VertX Integration
</a>
</li>
<li class="chapter " data-level="1.54" data-path="cdi-integration.html">
<a href="cdi-integration.html">
CDI Integration
</a>
</li>
<li class="chapter " data-level="1.55" data-path="intercepting-operations.html">
<a href="intercepting-operations.html">
Intercepting Operations
</a>
</li>
<li class="chapter " data-level="1.56" data-path="protocols-interoperability.html">
<a href="protocols-interoperability.html">
Protocols and Interoperability
</a>
</li>
<li class="chapter " data-level="1.57" data-path="tools.html">
<a href="tools.html">
Tools
</a>
</li>
<li class="chapter " data-level="1.58" data-path="maven-plugin.html">
<a href="maven-plugin.html">
Maven Plugin
</a>
</li>
<li class="chapter " data-level="1.59" data-path="unit-testing.html">
<a href="unit-testing.html">
Unit Testing
</a>
</li>
<li class="chapter " data-level="1.60" data-path="perf-tuning.html">
<a href="perf-tuning.html">
Troubleshooting and Performance Tuning
</a>
</li>
<li class="chapter " data-level="1.61" 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="." >Queue Attributes</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="queue-attributes">Queue Attributes</h1>
<p>Queue attributes can be set in one of two ways. Either by configuring
them using the configuration file or by using the core API. This chapter
will explain how to configure each attribute and what effect the
attribute has.</p>
<h2 id="predefined-queues">Predefined Queues</h2>
<p>Queues can be predefined via configuration at a core level or at a JMS
level. Firstly let&apos;s look at a JMS level.</p>
<p>The following shows a queue predefined in the jms element of the <code>broker.xml</code>
configuration file.</p>
<pre><code>&lt;queue name=&quot;selectorQueue&quot;&gt;
&lt;selector string=&quot;color=&apos;red&apos;&quot;/&gt;
&lt;durable&gt;true&lt;/durable&gt;
&lt;/queue&gt;
</code></pre><p>This name attribute of queue defines the name of the queue. When we do
this at a jms level we follow a naming convention so the actual name of
the core queue will be <code>jms.queue.selectorQueue</code>.</p>
<p>The selector element defines what JMS message selector the predefined
queue will have. Only messages that match the selector will be added to
the queue. This is an optional element with a default of null when
omitted.</p>
<p>The durable element specifies whether the queue will be persisted. This
again is optional and defaults to true if omitted.</p>
<p>Secondly a queue can be predefined at a core level in the
<code>broker.xml</code> file. The following is an example.</p>
<pre><code>&lt;queues&gt;
&lt;queue name=&quot;jms.queue.selectorQueue&quot;&gt;
&lt;address&gt;jms.queue.selectorQueue&lt;/address&gt;
&lt;filter string=&quot;color=&apos;red&apos;&quot;/&gt;
&lt;durable&gt;true&lt;/durable&gt;
&lt;/queue&gt;
&lt;/queues&gt;
</code></pre><p>This is very similar to the JMS configuration, with 3 real differences
which are.</p>
<ol>
<li><p>The name attribute of queue is the actual name used for the queue
with no naming convention as in JMS.</p>
</li>
<li><p>The address element defines what address is used for routing
messages.</p>
</li>
<li><p>The filter uses the <em>Core filter syntax</em> (described in <a href="filter-expressions.html">filter Expressions</a>), <em>not</em> the
JMS selector syntax.</p>
</li>
</ol>
<h2 id="using-the-api">Using the API</h2>
<p>Queues can also be created using the core API or the management API.</p>
<p>For the core API, queues can be created via the
<code>org.apache.activemq.artemis.api.core.client.ClientSession</code> interface. There are
multiple <code>createQueue</code> methods that support setting all of the
previously mentioned attributes. There is one extra attribute that can
be set via this API which is <code>temporary</code>. setting this to true means
that the queue will be deleted once the session is disconnected.</p>
<p>Take a look at <a href="management.html">Management</a> for a description of the management API for creating
queues.</p>
<h2 id="configuring-queues-via-address-settings">Configuring Queues Via Address Settings</h2>
<p>There are some attributes that are defined against an address wildcard
rather than a specific queue. Here an example of an <code>address-setting</code>
entry that would be found in the <code>broker.xml</code> file.</p>
<pre><code>&lt;address-settings&gt;
&lt;address-setting match=&quot;jms.queue.exampleQueue&quot;&gt;
&lt;dead-letter-address&gt;jms.queue.deadLetterQueue&lt;/dead-letter-address&gt;
&lt;max-delivery-attempts&gt;3&lt;/max-delivery-attempts&gt;
&lt;redelivery-delay&gt;5000&lt;/redelivery-delay&gt;
&lt;expiry-address&gt;jms.queue.expiryQueue&lt;/expiry-address&gt;
&lt;last-value-queue&gt;true&lt;/last-value-queue&gt;
&lt;max-size-bytes&gt;100000&lt;/max-size-bytes&gt;
&lt;page-size-bytes&gt;20000&lt;/page-size-bytes&gt;
&lt;redistribution-delay&gt;0&lt;/redistribution-delay&gt;
&lt;send-to-dla-on-no-route&gt;true&lt;/send-to-dla-on-no-route&gt;
&lt;address-full-policy&gt;PAGE&lt;/address-full-policy&gt;
&lt;slow-consumer-threshold&gt;-1&lt;/slow-consumer-threshold&gt;
&lt;slow-consumer-policy&gt;NOTIFY&lt;/slow-consumer-policy&gt;
&lt;slow-consumer-check-period&gt;5&lt;/slow-consumer-check-period&gt;
&lt;auto-create-jms-queues&gt;true&lt;/auto-create-jms-queues&gt;
&lt;auto-delete-jms-queues&gt;true&lt;/auto-delete-jms-queues&gt;
&lt;auto-create-jms-topics&gt;true&lt;/auto-create-jms-topics&gt;
&lt;auto-delete-jms-topics&gt;true&lt;/auto-delete-jms-topics&gt;
&lt;/address-setting&gt;
&lt;/address-settings&gt;
</code></pre><p>The idea with address settings, is you can provide a block of settings
which will be applied against any addresses that match the string in the
<code>match</code> attribute. In the above example the settings would only be
applied to any addresses which exactly match the address
<code>jms.queue.exampleQueue</code>, but you can also use wildcards to apply sets
of configuration against many addresses. The wildcard syntax used is
described <a href="#wildcard-syntax">here</a>.</p>
<p>For example, if you used the <code>match</code> string <code>jms.queue.#</code> the settings
would be applied to all addresses which start with <code>jms.queue.</code> which
would be all JMS queues.</p>
<p>The meaning of the specific settings are explained fully throughout the
user manual, however here is a brief description with a link to the
appropriate chapter if available.</p>
<p><code>max-delivery-attempts</code> defines how many time a cancelled message can be
redelivered before sending to the <code>dead-letter-address</code>. A full
explanation can be found <a href="#undelivered-messages.configuring">here</a>.</p>
<p><code>redelivery-delay</code> defines how long to wait before attempting redelivery
of a cancelled message. see <a href="#undelivered-messages.delay">here</a>.</p>
<p><code>expiry-address</code> defines where to send a message that has expired. see
<a href="#message-expiry.configuring">here</a>.</p>
<p><code>expiry-delay</code> defines the expiration time that will be used for
messages which are using the default expiration time (i.e. 0). For
example, if <code>expiry-delay</code> is set to &quot;10&quot; and a message which is using
the default expiration time (i.e. 0) arrives then its expiration time of
&quot;0&quot; will be changed to &quot;10.&quot; However, if a message which is using an
expiration time of &quot;20&quot; arrives then its expiration time will remain
unchanged. Setting <code>expiry-delay</code> to &quot;-1&quot; will disable this feature. The
default is &quot;-1&quot;.</p>
<p><code>last-value-queue</code> defines whether a queue only uses last values or not.
see <a href="#last-value-queues">here</a>.</p>
<p><code>max-size-bytes</code> and <code>page-size-bytes</code> are used to set paging on an
address. This is explained <a href="#paging">here</a>.</p>
<p><code>redistribution-delay</code> defines how long to wait when the last consumer
is closed on a queue before redistributing any messages. see
<a href="#clusters">here</a>.</p>
<p><code>send-to-dla-on-no-route</code>. If a message is sent to an address, but the
server does not route it to any queues, for example, there might be no
queues bound to that address, or none of the queues have filters that
match, then normally that message would be discarded. However if this
parameter is set to true for that address, if the message is not routed
to any queues it will instead be sent to the dead letter address (DLA)
for that address, if it exists.</p>
<p><code>address-full-policy</code>. This attribute can have one of the following
values: PAGE, DROP, FAIL or BLOCK and determines what happens when an
address where <code>max-size-bytes</code> is specified becomes full. The default
value is PAGE. If the value is PAGE then further messages will be paged
to disk. If the value is DROP then further messages will be silently
dropped. If the value is FAIL then further messages will be dropped and
an exception will be thrown on the client-side. If the value is BLOCK
then client message producers will block when they try and send further
messages. See the following chapters for more info <a href="flow-control.html">Flow Control</a>, <a href="paging.html">Paging</a>.</p>
<p><code>slow-consumer-threshold</code>. The minimum rate of message consumption
allowed before a consumer is considered &quot;slow.&quot; Measured in
messages-per-second. Default is -1 (i.e. disabled); any other valid
value must be greater than 0.</p>
<p><code>slow-consumer-policy</code>. What should happen when a slow consumer is
detected. <code>KILL</code> will kill the consumer&apos;s connection (which will
obviously impact any other client threads using that same connection).
<code>NOTIFY</code> will send a CONSUMER_SLOW management notification which an
application could receive and take action with. See <a href="slow-consumers.html">slow consumers</a> for more details
on this notification.</p>
<p><code>slow-consumer-check-period</code>. How often to check for slow consumers on a
particular queue. Measured in seconds. Default is 5. See <a href="slow-consumers.html">slow consumers</a>
for more information about slow consumer detection.</p>
<p><code>auto-create-jms-queues</code>. Whether or not the broker should automatically
create a JMS queue when a JMS message is sent to a queue whose name fits
the address <code>match</code> (remember, a JMS queue is just a core queue which has
the same address and queue name) or a JMS consumer tries to connect to a
queue whose name fits the address <code>match</code>. Queues which are auto-created
are durable, non-temporary, and non-transient. Default is <code>true</code>.</p>
<p><code>auto-delete-jms-queues</code>. Whether or not the broker should automatically
delete auto-created JMS queues when they have both 0 consumers and 0 messages.
Default is <code>true</code>.</p>
<p><code>auto-create-jms-topics</code>. Whether or not the broker should automatically
create a JMS topic when a JMS message is sent to a topic whose name fits
the address <code>match</code> (remember, a JMS topic is just a core address which has
one or more core queues mapped to it) or a JMS consumer tries to subscribe
to a topic whose name fits the address <code>match</code>. Default is <code>true</code>.</p>
<p><code>auto-delete-jms-topics</code>. Whether or not the broker should automatically
delete auto-created JMS topics once the last subscription on the topic has
been closed. Default is <code>true</code>.</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="paging.html" class="navigation navigation-prev " aria-label="Previous page: Paging">
<i class="fa fa-angle-left"></i>
</a>
<a href="scheduled-messages.html" class="navigation navigation-next " aria-label="Next page: Scheduled Messages">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"Queue Attributes","level":"1.29","depth":1,"next":{"title":"Scheduled Messages","level":"1.30","depth":1,"path":"scheduled-messages.md","ref":"scheduled-messages.md","articles":[]},"previous":{"title":"Paging","level":"1.28","depth":1,"path":"paging.md","ref":"paging.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/","issues":"http://activemq.apache.org/","contribute":"http://activemq.apache.org/contributing.html"},"gitbook":"3.x.x","description":"ActiveMQ Artemis User Guide and Reference Documentation"},"file":{"path":"queue-attributes.md","mtime":"2017-03-08T02:35:03.000Z","type":"markdown"},"gitbook":{"version":"3.1.1","time":"2017-03-08T02:38:15.470Z"},"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>