blob: c878fb5eb987e2b51bc3135913e31edce6ffdb6a [file] [log] [blame]
<div class="wiki-content maincontent">
<p>The default setting for ActiveMQ is that all persistent messages outside of a transaction are sent to a broker are synchronous. This means that the send method is blocked until the message is received by the broker, its then written to disk - then a response is returned to the client and the send() unblocks with success or throws a JMSException if the send could not complete (e.g. due to a security exception).&#160; In the case of the persistent messages being sent in a transaction, only the commit is synchronous since if the commit succeeds, then it means that all of the sends and acknowledgements in the transaction succeeded.</p>
<p>For performance reasons you may wish to stream messages to the broker as fast as possible even if you are using persistent messages. So you can enable <strong>asynchronous sending</strong> of persistent messages using one of the following options</p>
<ul><li>set the useAsyncSend property on the ActiveMQConnectionFactory</li><li>set the property using the URI when you connect to the broker</li></ul>
<structured-macro ac:macro-id="44308207-4c2b-4a2a-9a3d-33831df7c467" ac:name="code" ac:schema-version="1"><plain-text-body>
tcp://localhost:61616?jms.useAsyncSend=true
</plain-text-body></structured-macro></div>