...
- Creation of nodes in any of the ZooKeeper create modes.
- Get and Set the data contents of arbitrary cluster nodes. (data being set must be convertable to byte[])
- Create and retrieve the list the child nodes attached to a particular node.
- A Distributed RoutePolicy that leverages a Leader election coordinated by ZooKeeper to determine if exchanges should get processed.
...
The path from the uri specifies the node in the ZooKeeper server (aka znode) that will be the target of the endpoint.
Options
Div | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
Wiki Markup | |||||||||||||||||||||||||||
{div:class=confluenceTableSmall}
|| Name || Default Value || Description ||
| {{path}} | | The node in the ZooKeeper server (aka znode) |
| {{listChildren}} | {{false}} | Whether the children of the node should be listed |
| {{repeat}} | {{false}} | Should changes to the znode be 'watched' and repeatedly processed. |
| {{backoff}} | {{5000}} | The time interval to backoff for after an error before retrying. |
| {{timeout}} | {{5000}} | The time interval to wait on connection before timing out. |
| {{create}} | {{false}} | Should the endpoint create the node if it does not currently exist. |
| {{createMode}} | {{EPHEMERAL}} | The create mode that should be used for the newly created node (see below). |
| {{sendEmptyMessageOnDelete}} | {{true}} | *Camel 2.10:* Upon the delete of a znode, should an empty message be send to the consumer |
{div} |
Use cases
Reading from a znode.
...
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'. Notice the testPayload must be convertable to byte[] as the data stored in ZooKeeper is byte based.
Code Block | ||||
---|---|---|---|---|
| ||||
ExchangeObject etestPayload = createExchangeWithBody(testPayload);... template.sendBodyAndHeader("direct:write-to-znode", etestPayload, "CamelZooKeeperNode", "/somepath/someothernode"); |
...
or using the header 'CamelZookeeperCreateMode'. Notice the testPayload must be convertable to byte[] as the data stored in ZooKeeper is byte based.
Code Block | ||||
---|---|---|---|---|
| ||||
ExchangeObject etestPayload = createExchangeWithBody(testPayload);... template.sendBodyAndHeader("direct:create-and-write-to-persistent-znode", etestPayload, "CamelZooKeeperCreateMode", "PERSISTENT"); |
...