ZooKeeper
Read, write, delete and watch the znodes of an Apache ZooKeeper cluster.
What’s inside
-
ZooKeeper component, URI syntax:
zookeeper:serverUrls/path
Please refer to the above links for usage and configuration details.
Maven coordinates
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-zookeeper-starter</artifactId>
</dependency> Spring Boot Auto-Configuration
The starter supports 12 options, which are listed below.
| Name | Description | Default | Type |
|---|---|---|---|
camel.component.zookeeper.autowired-enabled | Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching type, which then gets configured on the component. This can be used for automatic configuring JDBC data sources, JMS connection factories, AWS Clients, etc. | true | Boolean |
camel.component.zookeeper.backoff | The delay in milliseconds after the consumer failed to read or watch the znode (for example because the session expired) before it starts again: it opens a new session when the previous one can no longer be used, and reads the znode again. | 5000 | Long |
camel.component.zookeeper.bridge-error-handler | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions (if possible) occurred while the Camel consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. Important: This is only possible if the 3rd party component allows Camel to be alerted if an exception was thrown. Some components handle this internally only, and therefore bridgeErrorHandler is not possible. In other situations we may improve the Camel component to hook into the 3rd party component and make this possible for future releases. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | Boolean |
camel.component.zookeeper.configuration | A shared ZooKeeperConfiguration with the default options of the endpoints; each endpoint uses a copy of it. The option is a org.apache.camel.component.zookeeper.ZooKeeperConfiguration type. | ZooKeeperConfiguration | |
camel.component.zookeeper.create | Whether the producer creates the znode when a write finds that it does not exist. The new znode gets the body as data, the create mode of the createMode option (or of the CamelZookeeperCreateMode header) and the ACL of the CamelZookeeperAcl header (by default OPEN_ACL_UNSAFE, which gives anyone all permissions). Missing parent znodes are created as PERSISTENT znodes with OPEN_ACL_UNSAFE. A DELETE never creates a znode. | false | Boolean |
camel.component.zookeeper.create-mode | The create mode of a znode that the producer creates (see create). An EPHEMERAL znode is deleted when the session of the endpoint ends, such as when the route stops; with a SEQUENTIAL mode ZooKeeper appends a sequence number to the name, and each write creates a new znode. When this option is not set, the CamelZookeeperCreateMode header decides, and EPHEMERAL is used when there is no header either. | EPHEMERAL | String |
camel.component.zookeeper.enabled | Whether to enable auto configuration of the zookeeper component. This is enabled by default. | Boolean | |
camel.component.zookeeper.lazy-start-producer | Whether the producer should be started lazy (on the first message). By starting lazy you can use this to allow CamelContext and routes to startup in situations where a producer may otherwise fail during starting and cause the route to fail being started. By deferring this startup to be lazy then the startup failure can be handled during routing messages via Camel’s routing error handlers. Beware that when the first message is processed then creating and starting the producer may take a little time and prolong the total processing time of the processing. | false | Boolean |
camel.component.zookeeper.list-children | Whether to use the names of the child znodes (a List of String) instead of the data. The consumer sends the child names of the znode, and with repeat again each time a child is created or deleted. The producer, for an InOut exchange, sets the body to the child names of the endpoint path after the write or delete. | false | Boolean |
camel.component.zookeeper.repeat | Whether the consumer keeps watching the znode: it sends the data (or the child list) again each time it changes, and after a delete it waits for the znode to be created again. Without it, the consumer sends the data (or the child list) once, waiting for the znode to be created if it does not exist yet; only a delete of the znode before its next change still sends a message (see sendEmptyMessageOnDelete). | false | Boolean |
camel.component.zookeeper.send-empty-message-on-delete | Whether the consumer sends a message without a body when the znode is deleted, with the CamelZookeeperEventType header set to NodeDeleted. Does not apply with listChildren. | true | Boolean |
camel.component.zookeeper.timeout | The ZooKeeper session timeout in milliseconds that the client asks for: when the servers hear nothing from the client for this long, the session expires and its ephemeral znodes are deleted. The server keeps the value within its bounds, by default 2 to 20 times its tickTime. The client also derives its connect timeout per server (this value divided by the number of servers) and its read timeout (two thirds of this value) from it. Camel waits without a time limit for the client to connect. | 5000 | Integer |