blob: 7496c1a5ee665cb95c3c094fd43bb3e5637f4a08 [file] [log] [blame]
<div class="wiki-content maincontent"><h2 id="OptimizedAcknowledgement-Overview">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 id="OptimizedAcknowledgement-EnablingOptimizedAcknowledgementsusingaConnectionURI">Enabling Optimized Acknowledgements using a Connection URI</h3>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">
cf = new ActiveMQConnectionFactory("tcp://locahost:61616?jms.optimizeAcknowledge=true");
</pre>
</div></div>
<h3 id="OptimizedAcknowledgement-EnablingOptimizedAcknowledgementsattheConnectionFactoryLevel">Enabling Optimized Acknowledgements at the ConnectionFactory Level</h3>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">
((ActiveMQConnectionFactory)connectionFactory).setOptimizeAcknowledge(true);
</pre>
</div></div>
<h3 id="OptimizedAcknowledgement-EnablingOptimizedAcknowledgementsattheConnectionLevel">Enabling Optimized Acknowledgements at the Connection Level</h3>
<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<pre class="brush: java; gutter: false; theme: Default" style="font-size:12px;">
((ActiveMQConnection)connection).setOptimizeAcknowledge(true);
</pre>
</div></div>
<h3 id="OptimizedAcknowledgement-setOptimizeAcknowledgeTimeOut(5.6)">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>