| = Etcd v3 Component |
| :doctitle: Etcd v3 |
| :shortname: etcd3 |
| :artifactid: camel-etcd3 |
| :description: Get, set, delete or watch keys in etcd key-value store. |
| :since: 3.19 |
| :supportlevel: Preview |
| :tabs-sync-option: |
| :component-header: Both producer and consumer are supported |
| //Manually maintained attributes |
| :camel-spring-boot-name: etcd3 |
| |
| *Since Camel {since}* |
| |
| *{component-header}* |
| |
| The Etcd v3 component allows you to work with Etcd, a distributed reliable key-value store. |
| |
| 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-etcd3</artifactId> |
| <version>x.x.x</version> |
| <!-- use the same version as your Camel core version --> |
| </dependency> |
| ---- |
| |
| == URI Format |
| |
| ---------------------------- |
| etcd3:path[?options] |
| ---------------------------- |
| |
| // component-configure options: START |
| |
| // component-configure options: END |
| |
| // component options: START |
| include::partial$component-configure-options.adoc[] |
| include::partial$component-endpoint-options.adoc[] |
| // component options: END |
| |
| // endpoint options: START |
| |
| // endpoint options: END |
| |
| // component headers: START |
| include::partial$component-endpoint-headers.adoc[] |
| // component headers: END |
| |
| == Producer Operations (Since 3.20) |
| |
| Apache Camel supports different etcd operations. |
| |
| To define the operation, set the exchange header with a key of `CamelEtcdAction` |
| and a value set to one of the following: |
| |
| [width="100%",cols="10%,10%,10%,70%",options="header",] |
| |=== |
| |operation |input message body | output message body |description |
| |
| |set |*String* value of the key-value pair to put |`PutResponse` result of a put operation| Puts a new key-value pair into etcd where the option `path` or the exchange header `CamelEtcdPath` is the key. |
| You can set the key charset by setting the exchange header with |
| the key `CamelEtcdKeyCharset`. |
| You can set the value charset by setting the exchange header with |
| the key `CamelEtcdValueCharset`. |
| |
| |get |None |`GetResponse` result of the get operation | Retrieve the key-value pair(s) that match with the key corresponding to |
| the option `path` or the exchange header `CamelEtcdPath`. |
| You can set the key charset by setting the exchange header with |
| the key `CamelEtcdKeyCharset`. |
| You indicate if the key is a prefix by setting the exchange header with |
| the key `CamelEtcdIsPrefix` to `true`. |
| |
| |delete |None |`DeleteResponse` result of the delete operation |Delete the key-value pair(s) that match with the key corresponding to |
| the option `path` or the exchange header `CamelEtcdPath`. |
| You can set the key charset by setting the exchange header with |
| the key `CamelEtcdKeyCharset`. |
| You indicate if the key is a prefix by setting the exchange header with |
| the key `CamelEtcdIsPrefix` to `true`. |
| |
| == Consumer (Since 3.20) |
| |
| The consumer of the etcd components allows watching changes on the matching key-value pair(s). One exchange is created per event with the header `CamelEtcdPath` set to the path of the corresponding key-value pair and the body |
| of type `WatchEvent`. |
| |
| You can set the key charset by setting the exchange header with |
| the key `CamelEtcdKeyCharset`. |
| You indicate if the key is a prefix by setting the exchange header with |
| the key `CamelEtcdIsPrefix` to `true`. |
| |
| By default, the consumer receives only the latest changes, but it is also possible to start watching events from a specific revision by setting the option `fromIndex` to the expected starting index. |
| |
| == AggregationRepository |
| |
| The Etcd v3 component provides an `AggregationStrategy` to use etcd as the backend datastore. |
| |
| == RoutePolicy (Since 3.20) |
| |
| The Etcd v3 component provides a `RoutePolicy` to use etcd as clustered lock. |
| |
| |=== |
| |
| include::spring-boot:partial$starter.adoc[] |