blob: 4845e6cdde732a2997468e178fda8dd95198ef96 [file] [log] [blame]
<div class="wiki-content maincontent"><p>Starting with version 5.13.0, ActiveMQ supports wire format protocol detection. &#160; OpenWire, STOMP, AMQP, and MQTT can be automatically detected. &#160;This allows one transport to be shared for all 4 types of clients.</p><h3 id="AUTO-EnablingAUTOoverTCP">Enabling AUTO over TCP</h3><p>To configure ActiveMQ auto wire format detection over a TCP connection use the&#160;<code>auto</code>&#160;transport prefix. For example, add the following transport configuration in your XML file:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ &lt;transportConnector name=&quot;auto&quot; uri=&quot;auto://localhost:5671&quot;/&gt;]]></script>
</div></div><h3 id="AUTO-EnablingAUTOoverSSL">Enabling AUTO over SSL</h3><p>To configure ActiveMQ auto wire format detection over an SSL connection use the&#160;<code>auto+ssl</code>&#160;transport prefix. For example, add the following transport configuration in your XML file:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ &lt;transportConnector name=&quot;auto+ssl&quot; uri=&quot;auto+ssl://localhost:5671&quot;/&gt;
]]></script>
</div></div><ul><li>For more details on using SSL with ActiveMQ, see the following article (<a shape="rect" class="external-link" href="http://activemq.apache.org/how-do-i-use-ssl.html">How do I use SSL</a>).</li></ul><h3 id="AUTO-EnablingAUTOoverNIO">Enabling AUTO over NIO</h3><p>To configure ActiveMQ auto wire format detection over an NIO TCP connection use the&#160;<code>auto+nio</code>transport prefix. For example, add the following transport configuration in your XML file:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ &lt;transportConnector name=&quot;auto+nio&quot; uri=&quot;auto+nio://localhost:5671&quot;/&gt;]]></script>
</div></div><h3 id="AUTO-EnablingAUTOoverNIOSSL">Enabling AUTO over NIO SSL</h3><p>To configure ActiveMQ auto wire format detection over an NIO SSL connection use the&#160;<code>auto+nio+ssl</code>&#160;transport prefix. For example, add the following transport configuration in your XML file:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ &lt;transportConnector name=&quot;auto+nio+ssl&quot; uri=&quot;auto+nio+ssl://localhost:5671&quot;/&gt;]]></script>
</div></div><h3 id="AUTO-ConfiguringAUTOTransportOptions">Configuring AUTO Transport Options</h3><p>There are some configuration options that can be set.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Parameter Name</p></th><th colspan="1" rowspan="1" class="confluenceTh">Default Value</th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>protocolDetectionTimeOut</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>30000</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The time before a connection times out in milliseconds. This is similar to maxInactivityDuration. If a client makes a connection to but doesn't send data or enough data for the protocol to be detected then the thread will sit and wait for more data to come in over the socket. This will let the broker kill the connections if they do not complete the protocol initialization after a certain period of time. The default is 30 seconds. Set a default to &lt;= 0 to disable this.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>maxConnectionThreadPoolSize</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>MAX_INT</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>This option allows the configuration of the maximum size of the thread pool that handles connection attempts. Lowering this number can help prevent the broker from running out of threads if there are many different clients attempting to connect at the same time. By default it is turned off by setting to MAX_INT</p></td></tr></tbody></table></div><p><br clear="none">An example that configures the transport with a maximum protocol detection time of 5 seconds:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ &lt;transportConnector name=&quot;auto&quot; uri=&quot;auto://localhost:5671?protocolDetectionTimeOut=5000&quot;/&gt;]]></script>
</div></div><h3 id="AUTO-ConfiguringWireFormats">Configuring Wire Formats</h3><p>OpenWire is the default Wire Format that ActiveMQ uses.&#160; It provides a highly efficent binary format for high speed messaging.&#160; OpenWire options can be configured on a JMS client's connection URI string or on a Brokers transport bind URI.</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Parameter Prefix</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>wireFormat.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Applies the option to all wire formats.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>wireFormat.default.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Applies the option to the default format which is OpenWire</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>wireFormat.stomp.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span>Applies the option to the STOMP wire format</span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><span>wireFormat.amqp.</span></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span>Applies the option to the AMQP<span> wire format</span></span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>wireFormat.mqtt.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><span>Applies the option to the MQTT<span> wire format</span></span></p></td></tr></tbody></table></div><p>&#160;</p><p>An example of a property that applies to all formats:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ &lt;transportConnector name=&quot;auto&quot; uri=&quot;auto://localhost:5671?wireFormat.maxFrameSize=1000&quot;/&gt;]]></script>
</div></div><p>&#160;</p><p>An example of a property only applied to OpenWire would be:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ &lt;transportConnector name=&quot;auto&quot; uri=&quot;auto://localhost:5671?wireFormat.default.maxFrameSize=1000&quot;/&gt;]]></script>
</div></div><h3 id="AUTO-ConfiguringEnabledWireProtocols">Configuring Enabled Wire Protocols</h3><p>By default all wire protocols are available. &#160;This can be configured to only enable certain formats by setting the property &#160;auto<code>.protocols.</code>&#160;</p><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>default</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enables OpenWire</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>amqp</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enables AMQP format</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>stomp</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enables STOMP format</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p>mqtt</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enables MQTT format</p></td></tr></tbody></table></div><p>&#160;</p><p>An example showing only OpenWire and STOMP enabled:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="brush: java; gutter: false; theme: Default" type="syntaxhighlighter"><![CDATA[ &lt;transportConnector name=&quot;auto&quot; uri=&quot;auto://localhost:5671?auto.protocols=default,stomp&quot;/&gt;]]></script>
</div></div></div>