Modified: websites/production/camel/content/zookeeper.html
==============================================================================
--- websites/production/camel/content/zookeeper.html (original)
+++ websites/production/camel/content/zookeeper.html Wed Mar 12 17:19:36 2014
@@ -86,103 +86,40 @@
        <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.</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" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-&lt;dependency&gt;
+<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.</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" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[&lt;dependency&gt;
     &lt;groupId&gt;org.apache.camel&lt;/groupId&gt;
     &lt;artifactId&gt;camel-zookeeper&lt;/artifactId&gt;
     &lt;version&gt;x.x.x&lt;/version&gt;
     &lt;!-- use the same version as your Camel core version --&gt;
 &lt;/dependency&gt;
 ]]></script>
-</div></div>
-
-<h3 id="Zookeeper-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[
-zookeeper://zookeeper-server[:port][/path][?options]
+</div></div><h3 id="Zookeeper-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[zookeeper://zookeeper-server[:port][/path][?options]
 ]]></script>
-</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">
-<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 exi
 st. </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>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 to 
recursive get children of the zknode as well. </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>
-
-<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" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-from(&quot;zookeeper://localhost:39913/somepath/somenode&quot;).to(&quot;mock:result&quot;);
+</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">
+<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 exi
 st. </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><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" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[from(&quot;zookeeper://localhost:39913/somepath/somenode&quot;).to(&quot;mock:result&quot;);
 ]]></script>
-</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" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-from(&quot;zookeeper://localhost:39913/somepath/somenode?awaitCreation=true&quot;).to(&quot;mock:result&quot;);
+</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" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[from(&quot;zookeeper://localhost:39913/somepath/somenode?awaitCreation=true&quot;).to(&quot;mock:result&quot;);
 ]]></script>
-</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" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-from(&quot;direct:write-to-znode&quot;).to(&quot;zookeeper://localhost:39913/somepath/somenode&quot;);
+</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" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[from(&quot;direct:write-to-znode&quot;).to(&quot;zookeeper://localhost:39913/somepath/somenode&quot;);
 ]]></script>
-</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'</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[
-Exchange e = createExchangeWithBody(testPayload);
+</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'</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[Exchange e = 
createExchangeWithBody(testPayload);
 template.sendBodyAndHeader(&quot;direct:write-to-znode&quot;, e, 
&quot;CamelZooKeeperNode&quot;, &quot;/somepath/someothernode&quot;);
 ]]></script>
-</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" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-from(&quot;direct:create-and-write-to-znode&quot;).to(&quot;zookeeper://localhost:39913/somepath/somenode?create=true&quot;);
+</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" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[from(&quot;direct:create-and-write-to-znode&quot;).to(&quot;zookeeper://localhost:39913/somepath/somenode?create=true&quot;);
 ]]></script>
-</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" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-from(&quot;direct:delete-znode&quot;).setHeader(ZooKeeperMessage.ZOOKEEPER_OPERATION,
 
constant(&quot;DELETE&quot;)).to(&quot;zookeeper://localhost:39913/somepath/somenode&quot;);
+</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" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[from(&quot;direct:delete-znode&quot;).setHeader(ZooKeeperMessage.ZOOKEEPER_OPERATION,
 
constant(&quot;DELETE&quot;)).to(&quot;zookeeper://localhost:39913/somepath/somenode&quot;);
 ]]></script>
-</div></div>
-
-<p>or equivalently</p>
-
-<div class="code panel pdl" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-&lt;route&gt;
+</div></div><p>or equivalently</p><div class="code panel pdl" 
style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: xml; gutter: false" 
type="syntaxhighlighter"><![CDATA[&lt;route&gt;
   &lt;from uri=&quot;direct:delete-znode&quot; /&gt;
   &lt;setHeader headerName=&quot;CamelZookeeperOperation&quot;&gt;
      &lt;constant&gt;DELETE&lt;/constant&gt;
@@ -190,45 +127,18 @@ from(&quot;direct:delete-znode&quot;).se
   &lt;to uri=&quot;zookeeper://localhost:39913/somepath/somenode&quot; /&gt;
 &lt;/route&gt;
 ]]></script>
-</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" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-from(&quot;direct:create-and-write-to-persistent-znode&quot;).to(&quot;zookeeper://localhost:39913/somepath/somenode?create=true&amp;createMode=PERSISTENT&quot;);
+</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" style="border-width: 1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[from(&quot;direct:create-and-write-to-persistent-znode&quot;).to(&quot;zookeeper://localhost:39913/somepath/somenode?create=true&amp;createMode=PERSISTENT&quot;);
 ]]></script>
-</div></div>
-
-<p>or using the header 'CamelZookeeperCreateMode'</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[
-Exchange e = createExchangeWithBody(testPayload);
+</div></div><p>or using the header 'CamelZookeeperCreateMode'</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[Exchange e = 
createExchangeWithBody(testPayload);
 
template.sendBodyAndHeader(&quot;direct:create-and-write-to-persistent-znode&quot;,
 e, &quot;CamelZooKeeperCreateMode&quot;, &quot;PERSISTENT&quot;);
 ]]></script>
-</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_l
 eaderElection">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" style="border-width: 1px;"><div class="codeContent 
panelContent pdl">
-<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[
-ZooKeeperRoutePolicy policy = new 
ZooKeeperRoutePolicy(&quot;zookeeper:localhost:39913/someapp/somepolicy&quot;, 
1);
+</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" style="border-width: 
1px;"><div class="codeContent panelContent pdl">
+<script class="theme: Default; brush: java; gutter: false" 
type="syntaxhighlighter"><![CDATA[ZooKeeperRoutePolicy policy = new 
ZooKeeperRoutePolicy(&quot;zookeeper:localhost:39913/someapp/somepolicy&quot;, 
1);
 
from(&quot;direct:policy-controlled&quot;).routePolicy(policy).to(&quot;mock:controlled&quot;);
 ]]></script>
-</div></div>
-<h3 id="Zookeeper-SeeAlso">See Also</h3>
+</div></div><p></p><h3 id="Zookeeper-SeeAlso">See Also</h3>
 <ul><li><a shape="rect" href="configuring-camel.html">Configuring 
Camel</a></li><li><a shape="rect" 
href="component.html">Component</a></li><li><a shape="rect" 
href="endpoint.html">Endpoint</a></li><li><a shape="rect" 
href="getting-started.html">Getting Started</a></li></ul></div>
         </td>
         <td valign="top">


Reply via email to