Modified: websites/production/camel/content/mongodb.html ============================================================================== --- websites/production/camel/content/mongodb.html (original) +++ websites/production/camel/content/mongodb.html Thu Sep 11 10:19:20 2014 @@ -96,7 +96,7 @@ </div></div><h2 id="MongoDB-URIformat">URI format</h2><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[mongodb:connectionBean?database=databaseName&collection=collectionName&operation=operationName[&moreOptions...] ]]></script> -</div></div><h2 id="MongoDB-Endpointoptions">Endpoint options</h2><p>MongoDB endpoints support the following options, depending on whether they are acting like a Producer or as a Consumer (options vary based on the consumer type too).</p><div class="confluenceTableSmall"></div><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Producer</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Tailable Cursor Consumer</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>database</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required.</strong> The name of the database to which this endpoint will be bound. All operations will be executed against this database unless dynamicity is enabled and the <code>CamelMongoDbDatabase</code> header is set.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>collection</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required.</strong> The name of the collection (within th e specified database) to which this endpoint will be bound. All operations will be executed against this database unless dynamicity is enabled and the <code>CamelMongoDbDatabase</code> header is set.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>collectionIndex</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><str ong>Camel 2.12:</strong> An optional <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/index-single/" rel="nofollow">single field index</a> or <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/index-compound/" rel="nofollow">compound index</a> to create when inserting new collections.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>operation</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required for producers.</strong> The id of the operation this endpoint will exe cute. Pick from the following:</p><ul><li>Query operations: <code>findById</code>, <code>findOneByQuery</code>, <code>findAll</code>, <code>count</code></li><li>Write operations: <code>insert</code>, <code>save</code>, <code>update</code></li><li>Delete operations: <code>remove</code></li><li>Other operations: <code>getDbStats</code>, <code>getColStats</code>, <code>aggregate</code></li></ul></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>createCollection</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Determines whether the collection will be automatically created in the MongoDB database during endpoint initialisation if it doesn't exist already. If this option is <code>false</code> and the collection doesn't exist, an initialisation exception will be thrown.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>invokeGetLastError</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false (behaviour may be inherited from connections WriteConcern)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Instructs the MongoDB Java driver to invoke <code>getLastError()</code> after every call. Default behaviour in version 2.7.2 of the Mon goDB Java driver is that only network errors will cause the operation to fail, because the actual operation is executed asynchronously in the MongoDB server without holding up the client - to increase performance. The client can obtain the real result of the operation by explicitly invoking <code>getLastError()</code> on the <code>WriteResult</code> object returned or by setting the appropriate <code>WriteConcern</code>. If the backend operation has not finished yet, the client will block until the result is available. Setting this option to <code>true</code> will make the endpoint behave synchronously and return an Exception if the underlying operation failed.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="conf luenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>writeConcern</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none (driver's default)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Set a <code>WriteConcern</code> on the operation out of MongoDB's parameterised values. See <a shape="rect" class="external-link" href="http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html#valueOf(java.lang.String)" rel="nofollow">WriteConcern.valueOf(String)</a>.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>writeConcernRef</code></p></td><td col span="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets a custom <code>WriteConcern</code> that exists in the Registry. Specify the bean name.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>readPreference</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Available as of Camel 2.12.4, 2.13.1 and 2.14.0:</strong> Sets a <a shape="rect" class="external-link" href="http://api.mongodb.org/java/current/com/mongodb/ReadPreference.html" rel="nofollow">ReadPreference</a> on the connection. Accepted values are those supported by the <a shape="rect" class="external-link" href="http://api.mongodb.org/java/current/com/mongodb/ReadPreference.html#valueOf(java.lang.String)" rel="nofollow">ReadPreference#valueOf()</a> public API. Currently as of MongoDB-Java-Driver version 2.12.0 the supported values are: <code>primary</code>, <code>primaryPreferred</code>, <code>secondary</code>, <code>secondaryPreferred</code> and <code>nearest</code>. See also the <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/read-preference/" rel="nofollow">documentation</a> for more details about this option.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td ></tr><tr><td colspan="1" rowspan="1" >class="confluenceTd"><p><code>dynamicity</code></p></td><td colspan="1" >rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" >class="confluenceTd"><p>If set to true, the endpoint will inspect the ><code>CamelMongoDbDatabase</code> and <code>CamelMongoDbCollection</code> >headers of the incoming message, and if any of them exists, the target >collection and/or database will be overridden for that particular operation. >Set to false by default to avoid triggering the lookup on every Exchange if >the feature is not desired.</p></td><td colspan="1" rowspan="1" >class="confluenceTd"><p><img class="emoticon emoticon-tick" >src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" > data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" >class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" >class="confluenceTd"> <p><code>writeResultAsHeader</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Available as of Camel 2.10.3 and 2.11:</strong> In write operations (save, update, insert, etc.), instead of replacing the body with the WriteResult object returned by MongoDB, keep the input body untouched and place the WriteResult in the <code>CamelMongoWriteResult</code> header (constant <code>MongoDbConstants.WRITERESULT</code>).</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>persistentTailTracking</code></p></td><td colspan="1" rowspan="1" cla ss="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enables or disables persistent tail tracking for Tailable Cursor consumers. See below for more information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>persistentId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required if persistent tail tracking is enabled.</strong> The id of this persistent tail tracker, to separate its records from the rest on the tail-tracking collection.</p></td><td colspan="1" rowspan="1" class="confluenceTd">< p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackingIncreasingField</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required if persistent tail tracking is enabled.</strong> Correlation field in the incoming record which is of increasing nature and will be used to position the tailing cursor every time it is generated. The cursor will be (re)created with a query of type: tailTrackIncreasingField > lastValue (where lastValue is possibly recovered from persistent tail tracking). Can be of type Integer, Date, String, etc. NOTE: No support for dot notation at the current time , so the field should be at the top level of the document.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>cursorRegenerationDelay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>1000ms</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Establishes how long the endpoint will wait to regenerate the cursor after it has been killed by the MongoDB server (normal behaviour).</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788 /4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackDb</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>same as endpoint's</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Database on which the persistent tail tracker will store its runtime information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackCollection</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>camelTailTracking</p></td><td colspan="1" rowspa n="1" class="confluenceTd"><p>Collection on which the persistent tail tracker will store its runtime information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackField</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>lastTrackingValue</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Field in which the persistent tail tracker will store the last tracked value.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/ 4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr></tbody></table></div><h2 id="MongoDB-MongoDBoperations-producerendpoints">MongoDB operations - producer endpoints</h2><h3 id="MongoDB-Queryoperations">Query operations</h3><h4 id="MongoDB-findById">findById</h4><p>This operation retrieves only one element from the collection whose _id field matches the content of the IN message body. The incoming object can be anything that has an equivalent to a BSON type. See <a shape="rect" class="external-link" href="http://bsonspec.org/#/specification" rel="nofollow">http://bsonspec.org/#/specification</a> and <a shape="rect" class="external-link" href="http://www.mongodb.org/display/DOCS/Java+Types" rel="nofollow">http://www.mongodb.org/display/DOCS/Java+Types</a>.</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><h2 id="MongoDB-Endpointoptions">Endpoint options</h2><p>MongoDB endpoints support the following options, depending on whether they are acting like a Producer or as a Consumer (options vary based on the consumer type too).</p><div class="confluenceTableSmall"> </div><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Name</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Default Value</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Description</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Producer</p></th><th colspan="1" rowspan="1" class="confluenceTh"><p>Tailable Cursor Consumer</p></th></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>database</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required.</strong> The name of the database to which this endpoint will be bound. All operations will be executed against this database unless dynamicity is enabled and the <code>CamelMongoDbDatabase</code> header is set.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>collection</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required.</strong> The name of the collection (wit hin the specified database) to which this endpoint will be bound. All operations will be executed against this database unless dynamicity is enabled and the <code>CamelMongoDbDatabase</code> header is set.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>collectionIndex</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd">< p><strong>Camel 2.12:</strong> An optional <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/index-single/" rel="nofollow">single field index</a> or <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/index-compound/" rel="nofollow">compound index</a> to create when inserting new collections.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>operation</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required for producers.</strong> The id of the operation this endpoint wi ll execute. Pick from the following:</p><ul><li>Query operations: <code>findById</code>, <code>findOneByQuery</code>, <code>findAll</code>, <code>count</code></li><li>Write operations: <code>insert</code>, <code>save</code>, <code>update</code></li><li>Delete operations: <code>remove</code></li><li>Other operations: <code>getDbStats</code>, <code>getColStats</code>, <code>aggregate</code></li></ul></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>createCollection</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>true</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Determines whether the colle ction will be automatically created in the MongoDB database during endpoint initialisation if it doesn't exist already. If this option is <code>false</code> and the collection doesn't exist, an initialisation exception will be thrown.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>invokeGetLastError</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false (behaviour may be inherited from connections WriteConcern)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Instructs the MongoDB Java driver to invoke <code>getLastError()</code> after every call. Default behaviour in version 2.7.2 of t he MongoDB Java driver is that only network errors will cause the operation to fail, because the actual operation is executed asynchronously in the MongoDB server without holding up the client - to increase performance. The client can obtain the real result of the operation by explicitly invoking <code>getLastError()</code> on the <code>WriteResult</code> object returned or by setting the appropriate <code>WriteConcern</code>. If the backend operation has not finished yet, the client will block until the result is available. Setting this option to <code>true</code> will make the endpoint behave synchronously and return an Exception if the underlying operation failed.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class ="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>writeConcern</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none (driver's default)</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Set a <code>WriteConcern</code> on the operation out of MongoDB's parameterised values. See <a shape="rect" class="external-link" href="http://api.mongodb.org/java/current/com/mongodb/WriteConcern.html#valueOf(java.lang.String)" rel="nofollow">WriteConcern.valueOf(String)</a>.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>writeConcernRef</code></p></td>< td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Sets a custom <code>WriteConcern</code> that exists in the Registry. Specify the bean name.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>readPreference</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Available as of Camel 2.12.4, 2.13.1 and 2.14.0:</strong> Sets a <a shape="rect" class="external-link" href="http://api.mongodb.org/java/current/com/mongodb/ReadPreference.html" rel="nofollow">ReadPreference</a> on the connection. Accepted values are those supported by the <a shape="rect" class="external-link" href="http://api.mongodb.org/java/current/com/mongodb/ReadPreference.html#valueOf(java.lang.String)" rel="nofollow">ReadPreference#valueOf()</a> public API. Currently as of MongoDB-Java-Driver version 2.12.0 the supported values are: <code>primary</code>, <code>primaryPreferred</code>, <code>secondary</code>, <code>secondaryPreferred</code> and <code>nearest</code>. See also the <a shape="rect" class="external-link" href="http://docs.mongodb.org/manual/core/read-preference/" rel="nofollow">documentation</a> for more details about this option.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </ p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>dynamicity</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>If set to true, the endpoint will inspect the <code>CamelMongoDbDatabase</code> and <code>CamelMongoDbCollection</code> headers of the incoming message, and if any of them exists, the target collection and/or database will be overridden for that particular operation. Set to false by default to avoid triggering the lookup on every Exchange if the feature is not desired.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluen ceTd"><p><code>writeResultAsHeader</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Available as of Camel 2.10.3 and 2.11:</strong> In write operations (save, update, insert, etc.), instead of replacing the body with the WriteResult object returned by MongoDB, keep the input body untouched and place the WriteResult in the <code>CamelMongoWriteResult</code> header (constant <code>MongoDbConstants.WRITERESULT</code>).</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>persistentTailTracking</code></p></td><td colspan="1" rowspan=" 1" class="confluenceTd"><p>false</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Enables or disables persistent tail tracking for Tailable Cursor consumers. See below for more information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>persistentId</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required if persistent tail tracking is enabled.</strong> The id of this persistent tail tracker, to separate its records from the rest on the tail-tracking collection.</p></td><td colspan="1" rowspan="1" class="confluenc eTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackingIncreasingField</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>none</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Required if persistent tail tracking is enabled.</strong> Correlation field in the incoming record which is of increasing nature and will be used to position the tailing cursor every time it is generated. The cursor will be (re)created with a query of type: tailTrackIncreasingField > lastValue (where lastValue is possibly recovered from persistent tail tracking). Can be of type Integer, Date, String, etc. NOTE: No support for dot notation at the curren t time, so the field should be at the top level of the document.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>cursorRegenerationDelay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>1000ms</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Establishes how long the endpoint will wait to regenerate the cursor after it has been killed by the MongoDB server (normal behaviour).</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988 229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackDb</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>same as endpoint's</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Database on which the persistent tail tracker will store its runtime information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackCollection</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>camelTailTracking</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Collection on which the persistent tail tracker will store its runtime information.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-1988229788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tailTrackField</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>lastTrackingValue</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Field in which the persistent tail tracker will store the last tracked value.</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><img class="emoticon emoticon-tick" src="https://cwiki.apache.org/confluence/s/en_GB-19882 29788/4109/76e0dbb30bc8580e459c201f3535d84f9283a9ac.1/_/images/icons/emoticons/check.png" data-emoticon-name="tick" alt="(tick)"></p></td></tr></tbody></table></div><h2 id="MongoDB-MongoDBoperations-producerendpoints">MongoDB operations - producer endpoints</h2><h3 id="MongoDB-Queryoperations">Query operations</h3><h4 id="MongoDB-findById">findById</h4><p>This operation retrieves only one element from the collection whose _id field matches the content of the IN message body. The incoming object can be anything that has an equivalent to a BSON type. See <a shape="rect" class="external-link" href="http://bsonspec.org/#/specification" rel="nofollow">http://bsonspec.org/#/specification</a> and <a shape="rect" class="external-link" href="http://www.mongodb.org/display/DOCS/Java+Types" rel="nofollow">http://www.mongodb.org/display/DOCS/Java+Types</a>.</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("direct:findById") .to("mongodb:myDb?database=flights&collection=tickets&operation&operation=findById") .to("mock:resultFindById"); @@ -180,7 +180,11 @@ Object result = template.requestBody(&qu Long result = template.requestBodyAndHeader("direct:count", "irrelevantBody", MongoDbConstants.COLLECTION, "dynamicCollectionName"); assertTrue("Result is not of type Long", result instanceof Long); ]]></script> -</div></div><h4 id="MongoDB-getDbStats">getDbStats</h4><p>Equivalent of running the <code>db.stats()</code> command in the MongoDB shell, which displays useful statistic figures about the database.<br clear="none"> For example:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>From <strong>Camel 2.14</strong> onwards you can provide a <code>com.mongodb.DBObject</code> object in the message body as a query,<span style="color: rgb(34,34,34);"> and operation will return the amount of documents matching this criteria. </span></p><p><span style="color: rgb(34,34,34);"> </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[DBObject query = ... +Long count = template.requestBodyAndHeader("direct:count", query, MongoDbConstants.COLLECTION, "dynamicCollectionName"); +]]></script> +</div></div><p><span style="color: rgb(34,34,34);"><br clear="none"></span></p><h4 id="MongoDB-getDbStats">getDbStats</h4><p>Equivalent of running the <code>db.stats()</code> command in the MongoDB shell, which displays useful statistic figures about the database.<br clear="none"> For example:</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[> db.stats(); { "db" : "test",
Modified: websites/production/camel/content/mqtt.html ============================================================================== --- websites/production/camel/content/mqtt.html (original) +++ websites/production/camel/content/mqtt.html Thu Sep 11 10:19:20 2014 @@ -96,7 +96,7 @@ </div></div><h3 id="MQTT-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[mqtt://name[?options] ]]></script> -</div></div><p>Where <strong>name</strong> is the name you want to assign the component.</p><h3 id="MQTT-Options">Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Property</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"><p><code>host</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tcp://127.0.0.1:1883</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The URI of the MQTT broker to connect too - this component also supports SSL - e.g. <em>ssl://127.0.0.1:8883</em></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>localAddress</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluence Td"><p>The local InetAddress and port to use</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>connectAttemptsMax</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>-1</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The maximum number of attempts to establish an initial connection - <strong><em>-1</em></strong> in infinite.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>reconnectAttemptsMax</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>-1</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The maximum number of attempts to re-establish a connection after failure - <strong><em>-1</em></strong> in infinite.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>reconnectDelay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>10</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The time in mil liseconds between attempts to reestablish an initial or failed connection</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>reconnectBackOffMultiplier</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>2.0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The multiplier to use to the delay between connection attempts for successive failed connection attempts</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>reconnectDelayMax</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>30000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The maximum time in milliseconds between a new attempt to establish a connection. So even using the reconnectBackOffMultiplier, this property will define the maximum delay before another connection attempt to the MQTT broker</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>qualityOfService</code></p></td>< td colspan="1" rowspan="1" class="confluenceTd"><p><code>AtLeastOnce</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The MQTT Quality of Service to use for message exchanges. It can be one of <strong>AtMostOnce</strong>, <strong>AtLeastOnce</strong> or <strong>ExactlyOnce</strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>subscribeTopicName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The name of the Topic to subscribe to for messages</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>publishTopicName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code><em>camel/mqtt/test</em></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The default Topic to publish messages on</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>byDefaultRetain</code></p></td><td colspan=" 1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The default retain policy to be used on messages sent to the MQTT broker</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mqttTopicPropertyName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p class="p1"><em>MQTTTopicPropertyName</em></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The property name to look for on an Exchange for an individual published message. If this is set - the name will be used as the Topic to publish a message to the MQTT message broker. This option is removed since camel 2.14.0.</p><p><strong>Since Camel 2.14.0</strong>, Camel uses "<strong><span style="line-height: 1.4285715;">CamelMQTTSubscribeTopic</span></strong><span style="line-height: 1.4285715;">" as the topic property name of the MQTT consumer, and "</span><span style="line-height: 1.4285715;"><strong>CamelMQTTPublishTopic</stro ng>" as the topic property name of the MQTT producer. </span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mqttRetainPropertyName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MQTTRetain</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The property name to look for on an Exchange for an individual published message. If this is set (expects a Boolean value) - then the retain property will be set on the message sent to the MQTT message broker.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mqttQosPropertyName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MQTTQos</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The property name to look for on an Exchange for an individual published message. If this is set (one of <strong>AtMostOnce</strong>, <strong>AtLeastOnce</strong> or <strong>ExactlyOnce</strong> ) - then that QoS will be set on the m essage sent to the MQTT message broker.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>connectWaitInSeconds</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>10</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Delay in seconds the Component will wait for a connection to be established to the MQTT broker</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>disconnectWaitInSeconds</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>5</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>the number of seconds the Component will wait for a valid disconnect on stop() from the MQTT broker</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>sendWaitInSeconds</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>5</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The maximum time the Component will wait for a receipt from the MQTT broker to acknowledge a published message before throwing an exception</p></td></tr></tbody></table></div></div><p>You can append query options to the URI in the following format, <code>?option=value&option=value&...</code></p><h3 id="MQTT-Samples">Samples</h3><p>Sending messages:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl"> +</div></div><p>Where <strong>name</strong> is the name you want to assign the component.</p><h3 id="MQTT-Options">Options</h3><div class="confluenceTableSmall"><div class="table-wrap"><table class="confluenceTable"><tbody><tr><th colspan="1" rowspan="1" class="confluenceTh"><p>Property</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"><p><code>host</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>tcp://127.0.0.1:1883</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The URI of the MQTT broker to connect too - this component also supports SSL - e.g. <em>ssl://127.0.0.1:8883</em></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>localAddress</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluence Td"><p>The local InetAddress and port to use</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>connectAttemptsMax</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>-1</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The maximum number of attempts to establish an initial connection - <strong><em>-1</em></strong> in infinite.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>reconnectAttemptsMax</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>-1</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The maximum number of attempts to re-establish a connection after failure - <strong><em>-1</em></strong> in infinite.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>reconnectDelay</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>10</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The time in mil liseconds between attempts to reestablish an initial or failed connection</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>reconnectBackOffMultiplier</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>2.0</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The multiplier to use to the delay between connection attempts for successive failed connection attempts</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>reconnectDelayMax</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>30000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The maximum time in milliseconds between a new attempt to establish a connection. So even using the reconnectBackOffMultiplier, this property will define the maximum delay before another connection attempt to the MQTT broker</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>qualityOfService</code></p></td>< td colspan="1" rowspan="1" class="confluenceTd"><p><code>AtLeastOnce</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The MQTT Quality of Service to use for message exchanges. It can be one of <strong>AtMostOnce</strong>, <strong>AtLeastOnce</strong> or <strong>ExactlyOnce</strong></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>subscribeTopicName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p> </p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The name of the Topic to subscribe to for messages</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>publishTopicName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code><em>camel/mqtt/test</em></code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The default Topic to publish messages on</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>byDefaultRetain</code></p></td><td colspan=" 1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The default retain policy to be used on messages sent to the MQTT broker</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mqttTopicPropertyName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p class="p1"><em>MQTTTopicPropertyName</em></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The property name to look for on an Exchange for an individual published message. If this is set - the name will be used as the Topic to publish a message to the MQTT message broker. This option is removed since camel 2.14.0.</p><p><strong>Since Camel 2.14.0</strong>, Camel uses "<strong><span style="line-height: 1.4285715;">CamelMQTTSubscribeTopic</span></strong><span style="line-height: 1.4285715;">" to store the topic name of the MQTT consumer into the message header, and "</span><span style="line-height: 1.4285715;"><strong>CamelM QTTPublishTopic</strong>" to look up the topic name of the MQTT producer from the message header. </span></p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mqttRetainPropertyName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MQTTRetain</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The property name to look for on an Exchange for an individual published message. If this is set (expects a Boolean value) - then the retain property will be set on the message sent to the MQTT message broker.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>mqttQosPropertyName</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>MQTTQos</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The property name to look for on an Exchange for an individual published message. If this is set (one of <strong>AtMostOnce</strong>, <strong>AtLeastOnce</strong> or <strong>ExactlyOnce</st rong> ) - then that QoS will be set on the message sent to the MQTT message broker.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>connectWaitInSeconds</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>10</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Delay in seconds the Component will wait for a connection to be established to the MQTT broker</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>disconnectWaitInSeconds</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>5</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>the number of seconds the Component will wait for a valid disconnect on stop() from the MQTT broker</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>sendWaitInSeconds</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>5</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The maximum time the Component will wait for a receipt from the MQTT broker to acknowledge a published message before throwing an exception</p></td></tr></tbody></table></div></div><p>You can append query options to the URI in the following format, <code>?option=value&option=value&...</code></p><h3 id="MQTT-Samples">Samples</h3><p>Sending messages:</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("direct:foo").to("mqtt:cheese?publishTopicName=test.mqtt.topic"); ]]></script> </div></div><p>Consuming messages:</p><div class="code panel pdl" style="border-width: 1px;"><div class="codeContent panelContent pdl">