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 2019/03/31 15:23:09 UTC

svn commit: r1042911 [48/48] - in /websites/production/camel/content: ./ 2007/08/17/ 2008/04/08/ 2008/04/28/ 2009/01/19/ 2009/10/26/ 2012/01/17/ 2012/03/01/ 2019/03/ 2019/03/31/

Modified: websites/production/camel/content/zip-file-dataformat.html
==============================================================================
--- websites/production/camel/content/zip-file-dataformat.html (original)
+++ websites/production/camel/content/zip-file-dataformat.html Sun Mar 31 15:23:07 2019
@@ -88,16 +88,16 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="ZipFileDataFormat-ZipFile">Zip File</h2><div class="confluence-information-macro confluence-information-macro-tip conf-macro output-block" data-hasbody="true" data-macro-name="tip"><p class="title">Available since Camel 2.11.0</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"> </span><div class="confluence-information-macro-body">&#160;</div></div><p>The Zip File <a shape="rect" href="data-format.html">Data Format</a> is a message compression and de-compression format. Messages can be marshalled (compressed) to Zip files containing a single entry, and Zip files containing a single entry can be unmarshalled (decompressed) to the original file contents. This data format supports ZIP64, as long as <a shape="rect" class="external-link" href="https://blogs.oracle.com/xuemingshen/entry/zip64_support_for_4g_zipfile" rel="nofollow">Java 7 or later is being used</a>.</p><p>Since Camel 2.12.3 there is 
 also a aggregation strategy that can aggregate multiple messages into a single Zip file.</p><h3 id="ZipFileDataFormat-Marshal">Marshal</h3><p>In this example we marshal a regular text/XML payload to a compressed payload using Zip file compression, and send it to an ActiveMQ queue called MY_QUEUE.</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 id="ZipFileDataFormat-ZipFile">Zip File</h2><div class="confluence-information-macro confluence-information-macro-tip conf-macro output-block" data-hasbody="true" data-macro-name="tip"><p class="title">Available since Camel 2.11.0</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"> </span><div class="confluence-information-macro-body">&#160;</div></div><p>The Zip File <a shape="rect" href="data-format.html">Data Format</a> is a message compression and de-compression format. Messages can be marshalled (compressed) to Zip files containing a single entry, and Zip files containing a single entry can be unmarshalled (decompressed) to the original file contents. This data format supports ZIP64, as long as <a shape="rect" class="external-link" href="https://blogs.oracle.com/xuemingshen/entry/zip64_support_for_4g_zipfile" rel="nofollow">Java 7 or later is being used</a>.</p><p>Since Camel 2.12.3 there is 
 also a aggregation strategy that can aggregate multiple messages into a single Zip file.</p><h3 id="ZipFileDataFormat-Marshal">Marshal</h3><p>In this example we marshal a regular text/XML payload to a compressed payload using Zip file compression, and send it to an ActiveMQ queue called MY_QUEUE.</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">from("direct:start").marshal().zipFile().to("activemq:queue:MY_QUEUE");</pre>
-</div></div><p>The name of the Zip entry inside the created Zip file is based on the incoming <code>CamelFileName</code> message header, which is the standard message header used by the <a shape="rect" href="file2.html">file component</a>. Additionally, the outgoing <code>CamelFileName</code> message header is automatically set to the value of the incoming <code>CamelFileName</code> message header, with the ".zip" suffix. So for example, if the following route finds a file named "test.txt" in the input directory, the output will be a Zip file named "test.txt.zip" containing a single Zip entry named "test.txt":</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>The name of the Zip entry inside the created Zip file is based on the incoming <code>CamelFileName</code> message header, which is the standard message header used by the <a shape="rect" href="file2.html">file component</a>. Additionally, the outgoing <code>CamelFileName</code> message header is automatically set to the value of the incoming <code>CamelFileName</code> message header, with the ".zip" suffix. So for example, if the following route finds a file named "test.txt" in the input directory, the output will be a Zip file named "test.txt.zip" containing a single Zip entry named "test.txt":</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">from("file:input/directory?antInclude=*/.txt").marshal().zipFile().to("file:output/directory");</pre>
-</div></div><p>If there is no incoming <code>CamelFileName</code> message header (for example, if the <a shape="rect" href="file2.html">file component</a> is not the consumer), then the message ID is used by default, and since the message ID is normally a unique generated ID, you will end up with filenames like <code>ID-MACHINENAME-2443-1211718892437-1-0.zip</code>. If you want to override this behavior, then you can set the value of the <code>CamelFileName</code> header explicitly in your route:</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>If there is no incoming <code>CamelFileName</code> message header (for example, if the <a shape="rect" href="file2.html">file component</a> is not the consumer), then the message ID is used by default, and since the message ID is normally a unique generated ID, you will end up with filenames like <code>ID-MACHINENAME-2443-1211718892437-1-0.zip</code>. If you want to override this behavior, then you can set the value of the <code>CamelFileName</code> header explicitly in your route:</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">from("direct:start").setHeader(Exchange.FILE_NAME, constant("report.txt")).marshal().zipFile().to("file:output/directory");</pre>
-</div></div><p>This route would result in a Zip file named "report.txt.zip" in the output directory, containing a single Zip entry named "report.txt".</p><h3 id="ZipFileDataFormat-Unmarshal">Unmarshal</h3><p>In this example we unmarshal a Zip file payload from an ActiveMQ queue called MY_QUEUE to its original format, and forward it for processing to the <code>UnZippedMessageProcessor</code>.</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>This route would result in a Zip file named "report.txt.zip" in the output directory, containing a single Zip entry named "report.txt".</p><h3 id="ZipFileDataFormat-Unmarshal">Unmarshal</h3><p>In this example we unmarshal a Zip file payload from an ActiveMQ queue called MY_QUEUE to its original format, and forward it for processing to the <code>UnZippedMessageProcessor</code>.</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">from("activemq:queue:MY_QUEUE").unmarshal().zipFile().process(new UnZippedMessageProcessor());&#160;
 </pre>
-</div></div><p>If the zip file has more then one entry, the usingIterator option of ZipFileDataFormat to be true, and you can use splitter to do the further work.</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>If the zip file has more then one entry, the usingIterator option of ZipFileDataFormat to be true, and you can use splitter to do the further work.</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">  ZipFileDataFormat zipFile = new ZipFileDataFormat();
   zipFile.setUsingIterator(true);
   from("file:src/test/resources/org/apache/camel/dataformat/zipfile/?consumer.delay=1000&amp;noop=true")
@@ -107,21 +107,21 @@
           .process(new UnZippedMessageProcessor())
     .end();
 </pre>
-</div></div><p>Or you can use the ZipSplitter as an expression for splitter directly like this</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Or you can use the ZipSplitter as an expression for splitter directly like this</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">   from("file:src/test/resources/org/apache/camel/dataformat/zipfile?consumer.delay=1000&amp;noop=true")
      .split(new ZipSplitter())
         .streaming()
         .process(new UnZippedMessageProcessor())
      .end();
 </pre>
-</div></div><h3 id="ZipFileDataFormat-Aggregate">Aggregate</h3><div class="confluence-information-macro confluence-information-macro-tip conf-macro output-block" data-hasbody="true" data-macro-name="tip"><p class="title">Available since Camel 2.12.3</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"> </span><div class="confluence-information-macro-body">&#160;</div></div><div><div class="confluence-information-macro confluence-information-macro-information conf-macro output-block" data-hasbody="true" data-macro-name="info"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"> </span><div class="confluence-information-macro-body"><p>Please note that this aggregation strategy requires eager completion check to work properly.</p></div></div><p>&#160;</p><p>In this example we aggregate all text files found in the input directory into a single Zip file that is stored in the output directory.&#160;</p><div c
 lass="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="ZipFileDataFormat-Aggregate">Aggregate</h3><div class="confluence-information-macro confluence-information-macro-tip conf-macro output-block" data-hasbody="true" data-macro-name="tip"><p class="title">Available since Camel 2.12.3</p><span class="aui-icon aui-icon-small aui-iconfont-approve confluence-information-macro-icon"> </span><div class="confluence-information-macro-body">&#160;</div></div><div><div class="confluence-information-macro confluence-information-macro-information conf-macro output-block" data-hasbody="true" data-macro-name="info"><span class="aui-icon aui-icon-small aui-iconfont-info confluence-information-macro-icon"> </span><div class="confluence-information-macro-body"><p>Please note that this aggregation strategy requires eager completion check to work properly.</p></div></div><p>&#160;</p><p>In this example we aggregate all text files found in the input directory into a single Zip file that is stored in the output directory.&#160;</p><div c
 lass="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">   from("file:input/directory?antInclude=*/.txt")
      .aggregate(new ZipAggregationStrategy())
        .constant(true)
        .completionFromBatchConsumer()
        .eagerCheckCompletion()
    .to("file:output/directory");</pre>
-</div></div><p>&#160;</p></div><div>The outgoing&#160;<code>CamelFileName</code>&#160;message header is created using &#160;java.io.File.createTempFile, with the ".zip" suffix.&#160;If you want to override this behavior, then you can set the value of the&#160;<code>CamelFileName</code>&#160;header explicitly in your route:</div><div><p>&#160;</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>&#160;</p></div><div>The outgoing&#160;<code>CamelFileName</code>&#160;message header is created using &#160;java.io.File.createTempFile, with the ".zip" suffix.&#160;If you want to override this behavior, then you can set the value of the&#160;<code>CamelFileName</code>&#160;header explicitly in your route:</div><div><p>&#160;</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">   from("file:input/directory?antInclude=*/.txt")
      .aggregate(new ZipAggregationStrategy())
        .constant(true)
@@ -129,7 +129,7 @@
        .eagerCheckCompletion()
      .setHeader(Exchange.FILE_NAME, constant("reports.zip"))
    .to("file:output/directory");</pre>
-</div></div><p>&#160;</p></div><h3 id="ZipFileDataFormat-Dependencies">Dependencies</h3><p>To use Zip files in your camel routes you need to add a dependency on <strong>camel-zipfile</strong> which implements this data format.</p><p>If you use Maven you can just add the following to your <code>pom.xml</code>, substituting the version number for the latest &amp; greatest release (see <a shape="rect" href="download.html">the download page for the latest versions</a>).</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>&#160;</p></div><h3 id="ZipFileDataFormat-Dependencies">Dependencies</h3><p>To use Zip files in your camel routes you need to add a dependency on <strong>camel-zipfile</strong> which implements this data format.</p><p>If you use Maven you can just add the following to your <code>pom.xml</code>, substituting the version number for the latest &amp; greatest release (see <a shape="rect" href="download.html">the download page for the latest versions</a>).</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">&lt;dependency&gt;
   &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
   &lt;artifactId&gt;camel-zipfile&lt;/artifactId&gt;

Modified: websites/production/camel/content/zookeeper.html
==============================================================================
--- websites/production/camel/content/zookeeper.html (original)
+++ websites/production/camel/content/zookeeper.html Sun Mar 31 15:23:07 2019
@@ -88,7 +88,7 @@
 	<tbody>
         <tr>
         <td valign="top" width="100%">
-<div class="wiki-content maincontent"><h2 id="Zookeeper-ZooKeeper">ZooKeeper</h2><p><strong>Available as of Camel 2.9</strong></p><p>The ZooKeeper component allows interaction with a <a shape="rect" class="external-link" href="http://hadoop.apache.org/zookeeper/">ZooKeeper</a> cluster and exposes the following features to Camel:</p><ol><li>Creation of nodes in any of the ZooKeeper create modes.</li><li>Get and Set the data contents of arbitrary cluster nodes. (data being set must be convertable to byte[])</li><li>Create and retrieve the list the child nodes attached to a particular node.</li><li>A Distributed <a shape="rect" href="routepolicy.html">RoutePolicy</a> that leverages a Leader election coordinated by ZooKeeper to determine if exchanges should get processed.</li></ol><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 conf-macro output-block" data-hasbody="true" data-macro-name="code" styl
 e="border-width: 1px;"><div class="codeContent panelContent pdl">
+<div class="wiki-content maincontent"><h2 id="Zookeeper-ZooKeeper">ZooKeeper</h2><p><strong>Available as of Camel 2.9</strong></p><p>The ZooKeeper component allows interaction with a <a shape="rect" class="external-link" href="http://hadoop.apache.org/zookeeper/">ZooKeeper</a> cluster and exposes the following features to Camel:</p><ol><li>Creation of nodes in any of the ZooKeeper create modes.</li><li>Get and Set the data contents of arbitrary cluster nodes. (data being set must be convertable to byte[])</li><li>Create and retrieve the list the child nodes attached to a particular node.</li><li>A Distributed <a shape="rect" href="routepolicy.html">RoutePolicy</a> that leverages a Leader election coordinated by ZooKeeper to determine if exchanges should get processed.</li></ol><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 conf-macro output-block" style="border-width: 1px;" data-hasbody="true" 
 data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">&lt;dependency&gt;
     &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
     &lt;artifactId&gt;camel-zookeeper&lt;/artifactId&gt;
@@ -96,32 +96,32 @@
     &lt;!-- use the same version as your Camel core version --&gt;
 &lt;/dependency&gt;
 </pre>
-</div></div><h3 id="Zookeeper-URIformat">URI format</h3><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="Zookeeper-URIformat">URI format</h3><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">zookeeper://zookeeper-server[:port][/path][?options]
 </pre>
 </div></div><p>The path from the uri specifies the node in the ZooKeeper server (aka znode) that will be the target of the endpoint.</p><h3 id="Zookeeper-Options">Options</h3><div class="confluenceTableSmall conf-macro output-block" data-hasbody="true" data-macro-name="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></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>path</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>&#160;</p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The node in the ZooKeeper server (aka znode)</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>listChildren</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan=
 "1" rowspan="1" class="confluenceTd"><p>Whether the children of the node should be listed</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>repeat</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Should changes to the znode be 'watched' and repeatedly processed.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>backoff</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>5000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The time interval to backoff for after an error before retrying.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>timeout</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>5000</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The time interval to wait on connection before timing out.</p></td></tr><tr><td colspan="1"
  rowspan="1" class="confluenceTd"><p><code>create</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>false</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>Should the endpoint create the node if it does not currently exist.</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>createMode</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>EPHEMERAL</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p>The create mode that should be used for the newly created node (see below).</p></td></tr><tr><td colspan="1" rowspan="1" class="confluenceTd"><p><code>sendEmptyMessageOnDelete</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><code>true</code></p></td><td colspan="1" rowspan="1" class="confluenceTd"><p><strong>Camel 2.10:</strong> Upon the delete of a znode, should an empty message be send to the consumer</p></td></tr></tbody></table></div></div>
 
 
-<h3 id="Zookeeper-Usecases">Use cases</h3><h4 id="Zookeeper-Readingfromaznode.">Reading from a znode.</h4><p>The following snippet will read the data from the znode '/somepath/somenode/' provided that it already exists. The data retrieved will<br clear="none"> be placed into an exchange and passed onto the rest of the route.</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<h3 id="Zookeeper-Usecases">Use cases</h3><h4 id="Zookeeper-Readingfromaznode.">Reading from a znode.</h4><p>The following snippet will read the data from the znode '/somepath/somenode/' provided that it already exists. The data retrieved will<br clear="none"> be placed into an exchange and passed onto the rest of the route.</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">from("zookeeper://localhost:39913/somepath/somenode").to("mock:result");
 </pre>
-</div></div><p>if the node does not yet exist then a flag can be supplied to have the endpoint await its creation</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>if the node does not yet exist then a flag can be supplied to have the endpoint await its creation</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">from("zookeeper://localhost:39913/somepath/somenode?awaitCreation=true").to("mock:result");
 </pre>
-</div></div><h4 id="Zookeeper-Readingfromaznode-(additionalCamel2.10onwards)">Reading from a znode - (additional Camel 2.10 onwards)</h4><p>When data is read due to a WatchedEvent received from the ZooKeeper ensemble, the CamelZookeeperEventType header holds ZooKeeper's <a shape="rect" class="external-link" href="http://zookeeper.apache.org/doc/current/api/org/apache/zookeeper/Watcher.Event.EventType.html">EventType</a> value from that WatchedEvent. If the data is read initially (not triggered by a WatchedEvent) the CamelZookeeperEventType header will not be set.</p><h4 id="Zookeeper-Writingtoaznode.">Writing to a znode.</h4><p>The following snippet will write the payload of the exchange into the znode at '/somepath/somenode/' provided that it already exists</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h4 id="Zookeeper-Readingfromaznode-(additionalCamel2.10onwards)">Reading from a znode - (additional Camel 2.10 onwards)</h4><p>When data is read due to a WatchedEvent received from the ZooKeeper ensemble, the CamelZookeeperEventType header holds ZooKeeper's <a shape="rect" class="external-link" href="http://zookeeper.apache.org/doc/current/api/org/apache/zookeeper/Watcher.Event.EventType.html">EventType</a> value from that WatchedEvent. If the data is read initially (not triggered by a WatchedEvent) the CamelZookeeperEventType header will not be set.</p><h4 id="Zookeeper-Writingtoaznode.">Writing to a znode.</h4><p>The following snippet will write the payload of the exchange into the znode at '/somepath/somenode/' provided that it already exists</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">from("direct:write-to-znode").to("zookeeper://localhost:39913/somepath/somenode");
 </pre>
-</div></div><p>For flexibility, the endpoint allows the target znode to be specified dynamically as a message header. If a header keyed by the string 'CamelZooKeeperNode' is present then the value of the header will be used as the path to the znode on the server. For instance using the same route definition above, the following code snippet will write the data not to '/somepath/somenode' but to the path from the header '/somepath/someothernode'. <strong>Notice</strong> the testPayload must be convertable to byte[] as the data stored in ZooKeeper is byte based.</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>For flexibility, the endpoint allows the target znode to be specified dynamically as a message header. If a header keyed by the string 'CamelZooKeeperNode' is present then the value of the header will be used as the path to the znode on the server. For instance using the same route definition above, the following code snippet will write the data not to '/somepath/somenode' but to the path from the header '/somepath/someothernode'. <strong>Notice</strong> the testPayload must be convertable to byte[] as the data stored in ZooKeeper is byte based.</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">Object testPayload = ...
 template.sendBodyAndHeader("direct:write-to-znode", testPayload, "CamelZooKeeperNode", "/somepath/someothernode");
 </pre>
-</div></div><p>To also create the node if it does not exist the 'create' option should be used.</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>To also create the node if it does not exist the 'create' option should be used.</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">from("direct:create-and-write-to-znode").to("zookeeper://localhost:39913/somepath/somenode?create=true");
 </pre>
-</div></div><p>Starting <strong>version 2.11</strong> it is also possible to <strong>delete</strong> a node using the header 'CamelZookeeperOperation' by setting it to 'DELETE'.</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>Starting <strong>version 2.11</strong> it is also possible to <strong>delete</strong> a node using the header 'CamelZookeeperOperation' by setting it to 'DELETE'.</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">from("direct:delete-znode").setHeader(ZooKeeperMessage.ZOOKEEPER_OPERATION, constant("DELETE")).to("zookeeper://localhost:39913/somepath/somenode");
 </pre>
-</div></div><p>or equivalently</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>or equivalently</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">&lt;route&gt;
   &lt;from uri="direct:delete-znode" /&gt;
   &lt;setHeader headerName="CamelZookeeperOperation"&gt;
@@ -130,14 +130,14 @@ template.sendBodyAndHeader("direct:write
   &lt;to uri="zookeeper://localhost:39913/somepath/somenode" /&gt;
 &lt;/route&gt;
 </pre>
-</div></div><p>ZooKeeper nodes can have different types; they can be 'Ephemeral' or 'Persistent' and 'Sequenced' or 'Unsequenced'. For further information of each type you can check <a shape="rect" class="external-link" href="http://zookeeper.apache.org/doc/trunk/zookeeperProgrammers.html#Ephemeral+Nodes">here</a>. By default endpoints will create unsequenced, ephemeral nodes, but the type can be easily manipulated via a uri config parameter or via a special message header. The values expected for the create mode are simply the names from the CreateMode enumeration</p><ul class="alternate"><li>PERSISTENT</li><li>PERSISTENT_SEQUENTIAL</li><li>EPHEMERAL</li><li>EPHEMERAL_SEQUENTIAL</li></ul><p>For example to create a persistent znode via the URI config</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>ZooKeeper nodes can have different types; they can be 'Ephemeral' or 'Persistent' and 'Sequenced' or 'Unsequenced'. For further information of each type you can check <a shape="rect" class="external-link" href="http://zookeeper.apache.org/doc/trunk/zookeeperProgrammers.html#Ephemeral+Nodes">here</a>. By default endpoints will create unsequenced, ephemeral nodes, but the type can be easily manipulated via a uri config parameter or via a special message header. The values expected for the create mode are simply the names from the CreateMode enumeration</p><ul class="alternate"><li>PERSISTENT</li><li>PERSISTENT_SEQUENTIAL</li><li>EPHEMERAL</li><li>EPHEMERAL_SEQUENTIAL</li></ul><p>For example to create a persistent znode via the URI config</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">from("direct:create-and-write-to-persistent-znode").to("zookeeper://localhost:39913/somepath/somenode?create=true&amp;createMode=PERSISTENT");
 </pre>
-</div></div><p>or using the header 'CamelZookeeperCreateMode'.&#160;<strong>Notice</strong>&#160;the testPayload must be convertable to byte[] as the data stored in ZooKeeper is byte based.</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><p>or using the header 'CamelZookeeperCreateMode'.&#160;<strong>Notice</strong>&#160;the testPayload must be convertable to byte[] as the data stored in ZooKeeper is byte based.</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">Object testPayload = ...
 template.sendBodyAndHeader("direct:create-and-write-to-persistent-znode", testPayload, "CamelZooKeeperCreateMode", "PERSISTENT");
 </pre>
-</div></div><h3 id="Zookeeper-ZooKeeperenabledRoutepolicy.">ZooKeeper enabled Route policy.</h3><p>ZooKeeper allows for very simple and effective leader election out of the box; This component exploits this election capability in a <a shape="rect" href="routepolicy.html">RoutePolicy</a> to control when and how routes are enabled. This policy would typically be used in fail-over scenarios, to control identical instances of a route across a cluster of Camel based servers. A very common scenario is a simple 'Master-Slave' setup where there are multiple instances of a route distributed across a cluster but only one of them, that of the master, should be running at a time. If the master fails, a new master should be elected from the available slaves and the route in this new master should be started.</p><p>The policy uses a common znode path across all instances of the RoutePolicy that will be involved in the election. Each policy writes its id into this node and zookeeper will order the
  writes in the order it received them. The policy then reads the listing of the node to see what postion of its id; this postion is used to determine if the route should be started or not. The policy is configured at startup with the number of route instances that should be started across the cluster and if its position in the list is less than this value then its route will be started. For a Master-slave scenario, the route is configured with 1 route instance and only the first entry in the listing will start its route. All policies watch for updates to the listing and if the listing changes they recalculate if their route should be started. For more info on Zookeeper's Leader election capability see <a shape="rect" class="external-link" href="http://zookeeper.apache.org/doc/trunk/recipes.html#sc_leaderElection">this page</a>.</p><p>The following example uses the node '/someapplication/somepolicy' for the election and is set up to start only the top '1' entries in the node listing 
 i.e. elect a master</p><div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+</div></div><h3 id="Zookeeper-ZooKeeperenabledRoutepolicy.">ZooKeeper enabled Route policy.</h3><p>ZooKeeper allows for very simple and effective leader election out of the box; This component exploits this election capability in a <a shape="rect" href="routepolicy.html">RoutePolicy</a> to control when and how routes are enabled. This policy would typically be used in fail-over scenarios, to control identical instances of a route across a cluster of Camel based servers. A very common scenario is a simple 'Master-Slave' setup where there are multiple instances of a route distributed across a cluster but only one of them, that of the master, should be running at a time. If the master fails, a new master should be elected from the available slaves and the route in this new master should be started.</p><p>The policy uses a common znode path across all instances of the RoutePolicy that will be involved in the election. Each policy writes its id into this node and zookeeper will order the
  writes in the order it received them. The policy then reads the listing of the node to see what postion of its id; this postion is used to determine if the route should be started or not. The policy is configured at startup with the number of route instances that should be started across the cluster and if its position in the list is less than this value then its route will be started. For a Master-slave scenario, the route is configured with 1 route instance and only the first entry in the listing will start its route. All policies watch for updates to the listing and if the listing changes they recalculate if their route should be started. For more info on Zookeeper's Leader election capability see <a shape="rect" class="external-link" href="http://zookeeper.apache.org/doc/trunk/recipes.html#sc_leaderElection">this page</a>.</p><p>The following example uses the node '/someapplication/somepolicy' for the election and is set up to start only the top '1' entries in the node listing 
 i.e. elect a master</p><div class="code panel pdl conf-macro output-block" style="border-width: 1px;" data-hasbody="true" data-macro-name="code"><div class="codeContent panelContent pdl">
 <pre class="syntaxhighlighter-pre" data-syntaxhighlighter-params="brush: java; gutter: false; theme: Default" data-theme="Default">ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy("zookeeper:localhost:39913/someapp/somepolicy", 1);
 from("direct:policy-controlled").routePolicy(policy).to("mock:controlled");
 </pre>