You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by bu...@apache.org on 2015/03/18 08:19:47 UTC
svn commit: r944183 - in /websites/production/camel/content:
cache/main.pageCache paho.html
Author: buildbot
Date: Wed Mar 18 07:19:46 2015
New Revision: 944183
Log:
Production update by buildbot for camel
Modified:
websites/production/camel/content/cache/main.pageCache
websites/production/camel/content/paho.html
Modified: websites/production/camel/content/cache/main.pageCache
==============================================================================
Binary files - no diff available.
Modified: websites/production/camel/content/paho.html
==============================================================================
--- websites/production/camel/content/paho.html (original)
+++ websites/production/camel/content/paho.html Wed Mar 18 07:19:46 2015
@@ -91,7 +91,10 @@
<p>Available as of Camel 2.16<span style="line-height: 1.4285715;"> </span></p>
</div>
</div>
-<p>Paho component provides connector for the MQTT messaging protocol using the <a shape="rect" class="external-link" href="https://eclipse.org/paho/" rel="nofollow">Paho</a> library.</p><h3 id="Paho-Addingthecomponenttotheproject">Adding the component to the project</h3><p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<p>Paho component provides connector for the MQTT messaging protocol using the <a shape="rect" class="external-link" href="https://eclipse.org/paho/" rel="nofollow">Eclipse Paho</a> library. Paho is one of the most popular MQTT libraries, so if you would like to integrate it with your Java project - Camel Paho connector is a way to go.</p><h3 id="Paho-URIformat"><span>URI format</span></h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[paho:queueName[?options]
+]]></script>
+</div></div><p><span>You can append query options to the URI in the following format: <code>?option=value&option=value&...</code> .</span></p><h3 id="Paho-Addingthecomponenttotheproject">Adding the component to the project</h3><p>Maven users will need to add the following dependency to their <code>pom.xml</code> for this component:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: xml; gutter: false" type="syntaxhighlighter"><![CDATA[<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-paho</artifactId>
@@ -109,24 +112,21 @@
</snapshots>
</repository>
</repositories>]]></script>
-</div></div><h3 id="Paho-Defaultpayloadtype">Default payload type</h3><p>By default Camel Paho component operates on the binary payloads extracted out of (or put into) the MQTT message:</p><p> </p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="Paho-Defaultpayloadtype"><span style="line-height: 1.5625;">Default payload type</span></h3><p><span style="line-height: 1.4285715;"> </span></p><p>By default Camel Paho component operates on the binary payloads extracted out of (or put into) the MQTT message:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[// Receive payload
byte[] payload = (byte[]) consumerTemplate.receiveBody("paho:topic");
Â
// Send payload
byte[] payload = "message".getBytes();
producerTemplate.sendBody("paho:topic", payload);]]></script>
-</div></div><p>But of course Camel can perform the automatic data type conversions for you:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p><span style="line-height: 1.4285715;"> </span></p><p>But of course Camel build-in <a shape="rect" href="type-converter.html">type conversion API</a> can perform the automatic data type transformations for you. In the example below Camel automatically converts binary payload into String (and conversely):</p><p><span style="line-height: 1.4285715;"> </span></p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[// Receive payload
String payload = consumerTemplate.receiveBody("paho:topic", String.class);
Â
// Send payload
String payload = "message";
producerTemplate.sendBody("paho:topic", payload);]]></script>
-</div></div><h3 id="Paho-URIformat">URI format</h3><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[paho:queueName[?options]
-]]></script>
-</div></div><p><span style="line-height: 1.4285715;">You can append query options to the URI in the following format: <code>?option=value&option=value&...</code> .</span></p><h3 id="Paho-URIOptions">URI Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>clientId</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>camel-<timestamp></code></td><td colspan="1" rowspan="1" class="confluenceTd">MQTT client identifier.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>brokerUrl</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tcp://localhost:1883</code></p></td><td colspan="1" rowspan="1" cl
ass="confluenceTd"><p>The URL of the MQTT broker.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>persistence</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>memory</code></td><td colspan="1" rowspan="1" class="confluenceTd">Client persistence to be used - <code>memory</code> or <code>file</code>.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>qos</code></td><td colspan="1" rowspan="1" class="confluenceTd">2</td><td colspan="1" rowspan="1" class="confluenceTd">Client quality of service level (<code>0</code>-<code>2</code>).</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>connectOptions</code></td><td colspan="1" rowspan="1" class="confluenceTd">none</td><td colspan="1" rowspan="1" class="confluenceTd">The reference to the <code><span style="line-height: 1.4285715;">org</span><span style="line-height: 1.4285715;">.eclipse.paho.client.mqttv3.</span><code style="line-height: 1.4285715;">MqttConnectOption
s</code></code><span style="line-height: 1.4285715;"> instance located in the Camel registry. Referenced </span><code>MqttConnectOptions</code> instance <span style="line-height: 1.4285715;">will be used by the endpoint to initialize the connection. For example <code>connectOptions=#my</code><span><code>ConnectOptions</code></span> notation can be used to reference Spring bean named <code>my</code><span><code>ConnectOptions.</code></span></span></td></tr></tbody></table></div></div><h3 id="Paho-Headers">Headers</h3><p>The following headers are recognized by the Paho component:</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Header</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Java constant</p></th><th colspan="1" rowspan="1" class="confluenceTh">Endpoint type</th><th colspan="1" rowspan="1" class="confluenceTh">Value type</th><th colspan="1" rowspan="1" class="con
fluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>PahoOriginalMessage</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code><span>PahoConstants.</span><span>HEADER_ORIGINAL_MESSAGE</span></code></td><td colspan="1" rowspan="1" class="confluenceTd">Consumer</td><td colspan="1" rowspan="1" class="confluenceTd"><code>org.eclipse.paho.client.mqttv3.MqttMessage</code></td><td colspan="1" rowspan="1" class="confluenceTd">The original Paho message instance received by the client.</td></tr></tbody></table></div></div><h3 id="Paho-Examples">Examples</h3><p>Read messages from the MQTT broker installed on the same host as the Camel router:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p><span style="line-height: 1.4285715;"><br clear="none"></span></p><h3 id="Paho-URIOptions">URI Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Option</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>clientId</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>camel-<timestamp></code></td><td colspan="1" rowspan="1" class="confluenceTd">MQTT client identifier.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>brokerUrl</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tcp://localhost:1883</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The URL of the MQTT broker.</p></td></tr><tr><td colspan="1" rowspan="1" class=
"confluenceTd"><code>persistence</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code>memory</code></td><td colspan="1" rowspan="1" class="confluenceTd">Client persistence to be used - <code>memory</code> or <code>file</code>.</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>qos</code></td><td colspan="1" rowspan="1" class="confluenceTd">2</td><td colspan="1" rowspan="1" class="confluenceTd">Client quality of service level (<code>0</code>-<code>2</code>).</td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>connectOptions</code></td><td colspan="1" rowspan="1" class="confluenceTd">none</td><td colspan="1" rowspan="1" class="confluenceTd">The reference to the <code><span style="line-height: 1.4285715;">org</span><span style="line-height: 1.4285715;">.eclipse.paho.client.mqttv3.</span><code style="line-height: 1.4285715;">MqttConnectOptions</code></code><span style="line-height: 1.4285715;"> instance located in the Camel registry. Referen
ced </span><code>MqttConnectOptions</code> instance <span style="line-height: 1.4285715;">will be used by the endpoint to initialize the connection. For example <code>connectOptions=#my</code><span><code>ConnectOptions</code></span> notation can be used to reference Spring bean named <code>my</code><span><code>ConnectOptions.</code></span></span></td></tr></tbody></table></div></div><h3 id="Paho-Headers">Headers</h3><p>The following headers are recognized by the Paho component:</p><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Header</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Java constant</p></th><th colspan="1" rowspan="1" class="confluenceTh">Endpoint type</th><th colspan="1" rowspan="1" class="confluenceTh">Value type</th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><code>Pah
oOriginalMessage</code></td><td colspan="1" rowspan="1" class="confluenceTd"><code><span>PahoConstants.</span><span>HEADER_ORIGINAL_MESSAGE</span></code></td><td colspan="1" rowspan="1" class="confluenceTd">Consumer</td><td colspan="1" rowspan="1" class="confluenceTd"><code>org.eclipse.paho.client.mqttv3.MqttMessage</code></td><td colspan="1" rowspan="1" class="confluenceTd">The original Paho message instance received by the client.</td></tr></tbody></table></div></div><h3 id="Paho-Examples">Examples</h3><p>Read messages from the MQTT broker installed on the same host as the Camel router:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">
<script class="theme: Default; brush: java; gutter: false" type="syntaxhighlighter"><![CDATA[from("paho:some/queue").
to("mock:test");]]></script>
</div></div><p>Read messages from the remote MQTT broker: </p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">