You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/01/28 19:06:34 UTC

[1/2] camel git commit: Yammer component Asciidoc documentation

Repository: camel
Updated Branches:
  refs/heads/master 8300779a6 -> 1dce414ec


Yammer component Asciidoc documentation


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1dce414e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1dce414e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1dce414e

Branch: refs/heads/master
Commit: 1dce414eca1cd91159721786dcd531b232414c99
Parents: d4f6339
Author: Antonin Stefanutti <an...@stefanutti.fr>
Authored: Thu Jan 28 18:59:06 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 28 19:06:27 2016 +0100

----------------------------------------------------------------------
 .../camel-yammer/src/main/docs/yammer.adoc      | 358 +++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |   1 +
 2 files changed, 359 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1dce414e/components/camel-yammer/src/main/docs/yammer.adoc
----------------------------------------------------------------------
diff --git a/components/camel-yammer/src/main/docs/yammer.adoc b/components/camel-yammer/src/main/docs/yammer.adoc
new file mode 100644
index 0000000..3527666
--- /dev/null
+++ b/components/camel-yammer/src/main/docs/yammer.adoc
@@ -0,0 +1,358 @@
+[[Yammer-Yammer]]
+Yammer
+~~~~~~
+
+*Available as of Camel 2.12*
+
+The Yammer component allows you to interact with the
+https://www.yammer.com[Yammer] enterprise social network. Consuming
+messages, users, and user relationships is supported as well as creating
+new messages.
+
+Yammer uses OAuth 2 for all client application authentication. In order
+to use camel-yammer with your account, you'll need to create a new
+application within Yammer and grant the application access to your
+account. Finally, generate your access token. More details are at
+https://developer.yammer.com/authentication/.
+
+Maven users will need to add the following dependency to their pom.xml
+for this component:
+
+[source,xml]
+----
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-yammer</artifactId>
+    <version>${camel-version}</version>
+</dependency>
+----
+
+[[Yammer-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source]
+----
+yammer:[function]?[options]
+----
+
+[[Yammer-ComponentOptions]]
+Component options
+^^^^^^^^^^^^^^^^^
+
+The Yammer component can be configured with the Yammer account settings
+which are mandatory to configure before using.
+
+// component options: START
+The Yammer component supports 4 options which are listed below.
+
+
+[width="100%",cols="2s,1m,8",options="header"]
+|=======================================================================
+| Name | Java Type | Description
+| consumerKey | String | The consumer key
+| consumerSecret | String | The consumer secret
+| accessToken | String | The access token
+| config | YammerConfiguration | To use a shared yammer configuration
+|=======================================================================
+// component options: END
+
+You can also configure these options directly in the endpoint.
+
+[[Yammer-EndpointOptions]]
+Endpoint options
+^^^^^^^^^^^^^^^^^
+
+// endpoint options: START
+The Yammer component supports 29 endpoint options which are listed below:
+
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| function | common |  | YammerFunctionType | *Required* The function to use
+| accessToken | common |  | String | *Required* The access token
+| consumerKey | common |  | String | *Required* The consumer key
+| consumerSecret | common |  | String | *Required* The consumer secret
+| useJson | common | false | boolean | Set to true if you want to use raw JSON rather than converting to POJOs.
+| bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| delay | consumer | 5000 | long | Delay between polling in millis
+| limit | consumer | -1 | int | Return only the specified number of messages. Works for threaded=true and threaded=extended.
+| newerThan | consumer | -1 | int | Returns messages newer than the message ID specified as a numeric string. This should be used when polling for new messages. If you're looking at messages and the most recent message returned is 3516 you can make a request with the parameter newerThan=3516 to ensure that you do not get duplicate copies of messages already on your page.
+| olderThan | consumer | -1 | int | Returns messages older than the message ID specified as a numeric string. This is useful for paginating messages. For example if you're currently viewing 20 messages and the oldest is number 2912 you could append olderThan=2912 to your request to get the 20 messages prior to those you're seeing.
+| sendEmptyMessageWhenIdle | consumer | false | boolean | If the polling consumer did not poll any files you can enable this option to send an empty message (no body) instead.
+| threaded | consumer |  | String | threaded=true will only return the first message in each thread. This parameter is intended for apps which display message threads collapsed. threaded=extended will return the thread starter messages in order of most recently active as well as the two most recent messages as they are viewed in the default view on the Yammer web interface.
+| userId | consumer |  | String | The user id
+| exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| pollStrategy | consumer (advanced) |  | PollingConsumerPollStrategy | A pluggable org.apache.camel.PollingConsumerPollingStrategy allowing you to provide your custom implementation to control error handling usually occurred during the poll operation before an Exchange have been created and being routed in Camel.
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+| backoffErrorThreshold | scheduler |  | int | The number of subsequent error polls (failed due some error) that should happen before the backoffMultipler should kick-in.
+| backoffIdleThreshold | scheduler |  | int | The number of subsequent idle polls that should happen before the backoffMultipler should kick-in.
+| backoffMultiplier | scheduler |  | int | To let the scheduled polling consumer backoff if there has been a number of subsequent idles/errors in a row. The multiplier is then the number of polls that will be skipped before the next actual attempt is happening again. When this option is in use then backoffIdleThreshold and/or backoffErrorThreshold must also be configured.
+| greedy | scheduler | false | boolean | If greedy is enabled then the ScheduledPollConsumer will run immediately again if the previous run polled 1 or more messages.
+| initialDelay | scheduler | 1000 | long | Milliseconds before the first poll starts.
+| runLoggingLevel | scheduler | TRACE | LoggingLevel | The consumer logs a start/complete log line when it polls. This option allows you to configure the logging level for that.
+| scheduledExecutorService | scheduler |  | ScheduledExecutorService | Allows for configuring a custom/shared thread pool to use for the consumer. By default each consumer has its own single threaded thread pool.
+| scheduler | scheduler | none | ScheduledPollConsumerScheduler | To use a cron scheduler from either camel-spring or camel-quartz2 component
+| schedulerProperties | scheduler |  | Map | To configure additional properties when using a custom scheduler or any of the Quartz2 Spring based scheduler.
+| startScheduler | scheduler | true | boolean | Whether the scheduler should be auto started.
+| timeUnit | scheduler | MILLISECONDS | TimeUnit | Time unit for initialDelay and delay options.
+| useFixedDelay | scheduler | true | boolean | Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details.
+|=======================================================================
+// endpoint options: END
+
+
+[[Yammer-Consumingmessages]]
+Consuming messages
+^^^^^^^^^^^^^^^^^^
+
+The Yammer component provides several endpoints for consuming
+messages:
+
+[width="100%",cols="2l,3",options="header",]
+|=======================================================================
+|URI |Description
+| yammer:messages?[options]
+|All public messages in the user's (whose access token is being used to
+make the API call) Yammer network. Corresponds to "All" conversations in
+the Yammer web interface.
+| yammer:my_feed?[options]
+|The user's feed, based on the selection they have made between
+"Following" and "Top" conversations.
+|yammer:algo?[options]
+|The algorithmic feed for the user that corresponds to "Top"
+conversations, which is what the vast majority of users will see in the
+Yammer web interface.
+|yammer:following?[options]
+|The "Following" feed which is conversations involving people, groups
+and topics that the user is following.
+|yammer:sent?[options]
+|All messages sent by the user.
+|yammer:private?[options]
+|Private messages received by the user.
+|yammer:received?[options]
+|*Camel 2.12.1:* All messages received by the user
+|=======================================================================
+
+
+[[Yammer-Messageformat]]
+Message format
+++++++++++++++
+
+All messages by default are converted to a POJO model provided in the
+`org.apache.camel.component.yammer.model` package. The original message
+coming from yammer is in JSON. For all message consuming and producing
+endpoints, a `Messages` object is returned. Take for example a route like:
+
+[source,java]
+----
+from("yammer:messages?consumerKey=aConsumerKey&consumerSecret=aConsumerSecretKey&accessToken=aAccessToken")
+    .to("mock:result");
+----
+
+and lets say the yammer server returns:
+
+[source,json]
+----
+{
+    "messages":[
+        {
+            "replied_to_id":null,
+            "network_id":7654,
+            "url":"https://www.yammer.com/api/v1/messages/305298242",
+            "thread_id":305298242,
+            "id":305298242,
+            "message_type":"update",
+            "chat_client_sequence":null,
+            "body":{
+                "parsed":"Testing yammer API...",
+                "plain":"Testing yammer API...",
+                "rich":"Testing yammer API..."
+            },
+            "client_url":"https://www.yammer.com/",
+            "content_excerpt":"Testing yammer API...",
+            "created_at":"2013/06/25 18:14:45 +0000",
+            "client_type":"Web",
+            "privacy":"public",
+            "sender_type":"user",
+            "liked_by":{
+                "count":1,
+                "names":[
+                    {
+                        "permalink":"janstey",
+                        "full_name":"Jonathan Anstey",
+                        "user_id":1499642294
+                    }
+
+                ]
+
+            },
+            "sender_id":1499642294,
+            "language":null,
+            "system_message":false,
+            "attachments":[
+
+            ],
+            "direct_message":false,
+            "web_url":"https://www.yammer.com/redhat.com/messages/305298242"
+        },
+        {
+            "replied_to_id":null,
+            "network_id":7654,
+            "url":"https://www.yammer.com/api/v1/messages/294326302",
+            "thread_id":294326302,
+            "id":294326302,
+            "message_type":"system",
+            "chat_client_sequence":null,
+            "body":{
+                "parsed":"(Principal Software Engineer) has [[tag:14658]] the redhat.com network. Take a moment to welcome Jonathan.",
+                "plain":"(Principal Software Engineer) has #joined the redhat.com network. Take a moment to welcome Jonathan.",
+                "rich":"(Principal Software Engineer) has #joined the redhat.com network. Take a moment to welcome Jonathan."
+            },
+            "client_url":"https://www.yammer.com/",
+            "content_excerpt":"(Principal Software Engineer) has #joined the redhat.com network. Take a moment to welcome Jonathan.",
+            "created_at":"2013/05/10 19:08:29 +0000",
+            "client_type":"Web",
+            "sender_type":"user",
+            "privacy":"public",
+            "liked_by":{
+                "count":0,
+                "names":[
+
+                ]
+
+            }
+        }
+        ]
+
+    }
+----
+
+Camel will marshal that into a `Messages` object containing 2 `Message`
+objects. As shown below there is a rich object model that makes it easy
+to get any information you need:
+
+[source,java]
+----
+Exchange exchange = mock.getExchanges().get(0);
+Messages messages = exchange.getIn().getBody(Messages.class);
+
+assertEquals(2, messages.getMessages().size());
+assertEquals("Testing yammer API...", messages.getMessages().get(0).getBody().getPlain());
+assertEquals("(Principal Software Engineer) has #joined the redhat.com network. Take a moment to welcome Jonathan.", messages.getMessages().get(1).getBody().getPlain());
+----
+
+That said, marshaling this data into POJOs is not free so if you need
+you can switch back to using pure JSON by adding the `useJson=false`
+option to your URI.
+
+[[Yammer-Creatingmessages]]
+Creating messages
+^^^^^^^^^^^^^^^^^
+
+To create a new message in the account of the current user, you can use
+the following URI:
+
+[source]
+----
+yammer:messages?[options]
+----
+
+The current Camel message body is what will be used to set the text of
+the Yammer message. The response body will include the new message
+formatted the same way as when you consume messages (i.e. as a `Messages`
+object by default).
+
+Take this route for instance:
+
+[source,java]
+----
+from("direct:start")
+    .to("yammer:messages?consumerKey=aConsumerKey&consumerSecret=aConsumerSecretKey&accessToken=aAccessToken")
+    .to("mock:result");
+----
+
+By sending to the `direct:start` endpoint a `"Hi from Camel!"` message body:
+
+[source,java]
+----
+template.sendBody("direct:start", "Hi from Camel!");
+----
+
+a new message will be created in the current user's account on the
+server and also this new message will be returned to Camel and converted
+into a `Messages` object. Like when consuming messages you can interrogate
+the `Messages` object:
+
+[source,java]
+----
+Exchange exchange = mock.getExchanges().get(0);
+Messages messages = exchange.getIn().getBody(Messages.class);
+
+assertEquals(1, messages.getMessages().size());
+assertEquals("Hi from Camel!", messages.getMessages().get(0).getBody().getPlain());
+----
+
+[[Yammer-Retrievinguserrelationships]]
+Retrieving user relationships
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+The Yammer component can retrieve user relationships:
+
+[source]
+----
+yammer:relationships?[options]
+----
+
+
+[[Yammer-Retrievingusers]]
+Retrieving users
+^^^^^^^^^^^^^^^^
+
+The Yammer component provides several endpoints for retrieving
+users:
+
+[width="100%",cols="2l,3",options="header",]
+|=====================================================
+|URI |Description
+|yammer:users?[options]
+|Retrieve users in the current user's Yammer network.
+|yammer:current?[options]
+|View data about the current user.
+|=====================================================
+
+
+[[Yammer-Usinganenricher]]
+Using an enricher
+^^^^^^^^^^^^^^^^^
+
+It is helpful sometimes (or maybe always in the case of users or
+relationship consumers) to use an enricher pattern rather than a route
+initiated with one of the polling consumers in camel-yammer. This is
+because the consumers will fire repeatedly, however often you set the
+delay for. If you just want to look up a user's data, or grab a message
+at a point in time, it is better to call that consumer once and then get
+one with your route.
+
+Lets say you have a route that at some point needs to go out and fetch
+user data for the current user. Rather than polling for this user over
+and over again, use the `pollEnrich` DSL method:
+
+[source,java]
+----
+from("direct:start")
+    .pollEnrich("yammer:current?consumerKey=aConsumerKey&consumerSecret=aConsumerSecretKey&accessToken=aAccessToken")
+    .to("mock:result");
+----
+
+This will go out and fetch the current user's `User` object and set it as
+the Camel message body.
+
+[[Yammer-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]

http://git-wip-us.apache.org/repos/asf/camel/blob/1dce414e/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 8ed8d9a..93dd7c8 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -104,6 +104,7 @@
 	* [SJMS](sjms.adoc)
 	* [SJMS Batch](sjms-batch.adoc)
 	* [Twitter](twitter.adoc)
+	* [Yammer](yammer.adoc)
 	* [ZooKeeper](zookeeper.adoc)
 
 <!--


[2/2] camel git commit: ZooKeeper component Asciidoc documentation

Posted by da...@apache.org.
ZooKeeper component Asciidoc documentation


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/d4f63390
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/d4f63390
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/d4f63390

Branch: refs/heads/master
Commit: d4f633903fb6405b2336a753231032412f99d21d
Parents: 8300779
Author: Antonin Stefanutti <an...@stefanutti.fr>
Authored: Thu Jan 28 18:26:31 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Thu Jan 28 19:06:27 2016 +0100

----------------------------------------------------------------------
 .../src/main/docs/zookeeper.adoc                | 254 +++++++++++++++++++
 docs/user-manual/en/SUMMARY.md                  |   1 +
 2 files changed, 255 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/d4f63390/components/camel-zookeeper/src/main/docs/zookeeper.adoc
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/main/docs/zookeeper.adoc b/components/camel-zookeeper/src/main/docs/zookeeper.adoc
new file mode 100644
index 0000000..c4c13d0
--- /dev/null
+++ b/components/camel-zookeeper/src/main/docs/zookeeper.adoc
@@ -0,0 +1,254 @@
+[[Zookeeper-ZooKeeper]]
+ZooKeeper
+~~~~~~~~~
+
+*Available as of Camel 2.9*
+
+The ZooKeeper component allows interaction with a
+http://hadoop.apache.org/zookeeper/[ZooKeeper] cluster and exposes the
+following features to Camel:
+
+1.  Creation of nodes in any of the ZooKeeper create modes.
+2.  Get and Set the data contents of arbitrary cluster nodes (data
+being set must be convertible to `byte[]`).
+3.  Create and retrieve the list the child nodes attached to a
+particular node.
+4.  A Distributed link:routepolicy.html[`RoutePolicy`] that leverages a
+Leader election coordinated by ZooKeeper to determine if exchanges
+should get processed.
+
+Maven users will need to add the following dependency to their `pom.xml`
+for this component:
+
+[source,xml]
+----
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-zookeeper</artifactId>
+    <version>x.x.x</version>
+    <!-- use the same version as your Camel core version -->
+</dependency>
+----
+
+[[Zookeeper-URIformat]]
+URI format
+^^^^^^^^^^
+
+[source]
+----
+zookeeper://zookeeper-server[:port][/path][?options]
+----
+
+The path from the URI specifies the node in the ZooKeeper server (a.k.a.
+_znode_) that will be the target of the endpoint:
+
+[[Zookeeper-Options]]
+Options
+^^^^^^^
+
+// endpoint options: START
+The ZooKeeper component supports 14 endpoint options which are listed below:
+
+[width="100%",cols="2s,1,1m,1m,5",options="header"]
+|=======================================================================
+| Name | Group | Default | Java Type | Description
+| serverUrls | common |  | String | *Required* The zookeeper server hosts (multiple servers can be separated by comma)
+| path | common |  | String | *Required* The node in the ZooKeeper server (aka znode)
+| awaitExistence | common | true | boolean | Not in use
+| listChildren | common | false | boolean | Whether the children of the node should be listed
+| timeout | common | 5000 | int | The time interval to wait on connection before timing out.
+| backoff | consumer | 5000 | long | The time interval to backoff for after an error before retrying.
+| bridgeErrorHandler | consumer | false | boolean | Allows for bridging the consumer to the Camel routing Error Handler which mean any exceptions occurred while the consumer is trying to pickup incoming messages or the likes will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| repeat | consumer | false | boolean | Should changes to the znode be 'watched' and repeatedly processed.
+| sendEmptyMessageOnDelete | consumer | true | boolean | Upon the delete of a znode should an empty message be send to the consumer
+| exceptionHandler | consumer (advanced) |  | ExceptionHandler | To let the consumer use a custom ExceptionHandler. Notice if the option bridgeErrorHandler is enabled then this options is not in use. By default the consumer will deal with exceptions that will be logged at WARN/ERROR level and ignored.
+| create | producer | false | boolean | Should the endpoint create the node if it does not currently exist.
+| createMode | producer | EPHEMERAL | String | The create mode that should be used for the newly created node
+| exchangePattern | advanced | InOnly | ExchangePattern | Sets the default exchange pattern when creating an exchange
+| synchronous | advanced | false | boolean | Sets whether synchronous processing should be strictly used or Camel is allowed to use asynchronous processing (if supported).
+|=======================================================================
+// endpoint options: END
+
+[[Zookeeper-Usecases]]
+Use cases
+^^^^^^^^^
+
+[[Zookeeper-Readingfromaznode]]
+Reading from a _znode_
++++++++++++++++++++++
+
+The following snippet will read the data from the _znode_
+`/somepath/somenode/` provided that it already exists. The data
+retrieved will be placed into an exchange and passed onto
+the rest of the route:
+
+[source,java]
+----
+from("zookeeper://localhost:39913/somepath/somenode").to("mock:result");
+----
+
+If the node does not yet exist then a flag can be supplied to have the
+endpoint await its creation:
+
+[source,java]
+----
+from("zookeeper://localhost:39913/somepath/somenode?awaitCreation=true").to("mock:result");
+----
+
+[[Zookeeper-ReadingfromaznodeAdditionalCamel210onwards]]
+Reading from a _znode_ (additional Camel 2.10 onwards)
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+When data is read due to a `WatchedEvent` received from the ZooKeeper
+ensemble, the `CamelZookeeperEventType` header holds ZooKeeper's
+http://zookeeper.apache.org/doc/current/api/org/apache/zookeeper/Watcher.Event.EventType.html[`EventType`]
+value from that `WatchedEvent`. If the data is read initially (not
+triggered by a `WatchedEvent`) the `CamelZookeeperEventType` header will not
+be set.
+
+[[Zookeeper-Writingtoaznode]]
+Writing to a _znode_
+++++++++++++++++++++
+
+The following snippet will write the payload of the exchange into the
+znode at `/somepath/somenode/` provided that it already exists:
+
+[source,java]
+----
+from("direct:write-to-znode")
+    .to("zookeeper://localhost:39913/somepath/somenode");
+----
+
+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`.
+
+WARNING: the `testPayload` must be convertible
+to `byte[]` as the data stored in ZooKeeper is byte based.
+
+[source,java]
+----
+Object testPayload = ...
+template.sendBodyAndHeader("direct:write-to-znode", testPayload, "CamelZooKeeperNode", "/somepath/someothernode");
+----
+
+To also create the node if it does not exist the `create` option should
+be used.
+
+[source,java]
+----
+from("direct:create-and-write-to-znode")
+    .to("zookeeper://localhost:39913/somepath/somenode?create=true");
+----
+
+Starting *version 2.11* it is also possible to *delete* a node using the
+header `CamelZookeeperOperation` by setting it to `DELETE`:
+
+[source,java]
+----
+from("direct:delete-znode")
+    .setHeader(ZooKeeperMessage.ZOOKEEPER_OPERATION, constant("DELETE"))
+    .to("zookeeper://localhost:39913/somepath/somenode");
+----
+
+or equivalently:
+
+[source,xml]
+----
+<route>
+  <from uri="direct:delete-znode" />
+  <setHeader headerName="CamelZookeeperOperation">
+     <constant>DELETE</constant>
+  </setHeader>
+  <to uri="zookeeper://localhost:39913/somepath/somenode" />
+</route>
+----
+
+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
+http://zookeeper.apache.org/doc/trunk/zookeeperProgrammers.html#Ephemeral+Nodes[here].
+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:
+
+* `PERSISTENT`
+* `PERSISTENT_SEQUENTIAL`
+* `EPHEMERAL`
+* `EPHEMERAL_SEQUENTIAL`
+
+For example to create a persistent _znode_ via the URI config:
+
+[source,java]
+----
+from("direct:create-and-write-to-persistent-znode")
+    .to("zookeeper://localhost:39913/somepath/somenode?create=true&createMode=PERSISTENT");
+----
+
+or using the header `CamelZookeeperCreateMode`.
+
+WARNING: the `testPayload` must be convertible to `byte[]` as the data stored in
+ZooKeeper is byte based.
+
+[source,java]
+----
+Object testPayload = ...
+template.sendBodyAndHeader("direct:create-and-write-to-persistent-znode", testPayload, "CamelZooKeeperCreateMode", "PERSISTENT");
+----
+
+[[Zookeeper-ZooKeeperenabledRoutepolicy]]
+ZooKeeper enabled Route policy
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+ZooKeeper allows for very simple and effective leader election out of
+the box. This component exploits this election capability in a
+link:routepolicy.html[`RoutePolicy`] 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.
+
+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 position of its id; this position 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
+http://zookeeper.apache.org/doc/trunk/recipes.html#sc_leaderElection[this
+page].
+
+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:
+
+[source,java]
+----
+ZooKeeperRoutePolicy policy = new ZooKeeperRoutePolicy("zookeeper:localhost:39913/someapp/somepolicy", 1);
+from("direct:policy-controlled")
+    .routePolicy(policy)
+    .to("mock:controlled");
+----
+
+[[Zookeeper-SeeAlso]]
+See Also
+^^^^^^^^
+
+* link:configuring-camel.html[Configuring Camel]
+* link:component.html[Component]
+* link:endpoint.html[Endpoint]
+* link:getting-started.html[Getting Started]

http://git-wip-us.apache.org/repos/asf/camel/blob/d4f63390/docs/user-manual/en/SUMMARY.md
----------------------------------------------------------------------
diff --git a/docs/user-manual/en/SUMMARY.md b/docs/user-manual/en/SUMMARY.md
index 4efcd7d..8ed8d9a 100644
--- a/docs/user-manual/en/SUMMARY.md
+++ b/docs/user-manual/en/SUMMARY.md
@@ -104,6 +104,7 @@
 	* [SJMS](sjms.adoc)
 	* [SJMS Batch](sjms-batch.adoc)
 	* [Twitter](twitter.adoc)
+	* [ZooKeeper](zookeeper.adoc)
 
 <!--
 * [Expession Languages](languages.adoc)