blob: f90b2093b2c9748195338703838becf9d7aef8be [file] [log] [blame]
<div class="wiki-content maincontent"><h2>Overview</h2>
<p>ActiveMQ supports acknowledging a range of messages in a single batch operations. This option is disabled by default but can be used to improve throughput in some circumstances as it decreases load on the broker. Consider enabling it for your performance test scenario to see if it is applicable.</p>
<h3>Enabling Optimized Acknowledgements using a Connection URI</h3>
<structured-macro ac:macro-id="ff5918d5-cf60-480e-8c91-0143e11d8c87" ac:name="code" ac:schema-version="1"><parameter ac:name="">java</parameter><plain-text-body>
cf = new ActiveMQConnectionFactory("tcp://locahost:61616?jms.optimizeAcknowledge=true");
</plain-text-body></structured-macro>
<h3>Enabling Optimized Acknowledgements at the ConnectionFactory Level</h3>
<structured-macro ac:macro-id="df0f6cc4-b780-4671-b0e8-3985ce49ee62" ac:name="code" ac:schema-version="1"><parameter ac:name="">java</parameter><plain-text-body>
((ActiveMQConnectionFactory)connectionFactory).setOptimizeAcknowledge(true);
</plain-text-body></structured-macro>
<h3>Enabling Optimized Acknowledgements at the Connection Level</h3>
<structured-macro ac:macro-id="0bb6ad1b-7bed-4ddd-89ae-679dc2d902a3" ac:name="code" ac:schema-version="1"><parameter ac:name="">java</parameter><plain-text-body>
((ActiveMQConnection)connection).setOptimizeAcknowledge(true);
</plain-text-body></structured-macro>
<h3>setOptimizeAcknowledgeTimeOut (5.6)</h3>
<p>Since 5.4.2 there is a default timeout on a batch optimized acknowledge which ensures that acks are timely even if consumers are slow. On slow networks, the timeout can expire before the batch limit is reached so the reduced bandwith utilisation is bypassed. In version 5.6, the timeout is configurable via the optimizeAcknowledgeTimeOut attribute. Set as above via the connectiion URI or at the factory and connection level. The default value is 300ms, a value of 0 disables.</p></div>