第 71 章 CouchDB Component

作为 Camel 2.11 版本提供

通过 couchdb: 组件,您可以将 CouchDB 实例视为生成者或消息使用者。使用轻量级 LightCouch API,这个 camel 组件具有以下特性:

  • 作为使用者,monitor couch changesets 用于插入、更新和删除和删除这些消息并将其作为消息发布到 camel 路由。
  • 作为制作者,可以保存,从 Camel 2.18 删除(通过使用带有 DELETE 值的 CouchDbMethod)文档,从 Camel 2.22 获取文档(通过使用带有 GET 值的 CouchDbMethod)获取文档。
  • 可以根据需要支持多个端点,例如在多个实例之间进行多个数据库。
  • 能够仅删除事件触发器,仅插入/更新或全部(默认)。
  • 为 sequenceId、文档修订、文档 ID 和 HTTP 方法类型设置的标头。

Maven 用户需要将以下依赖项添加到其 pom.xml 中:

<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-couchdb</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>

71.1. URI 格式

couchdb:http://hostname[:port]/database?[options]

其中 hostname 是正在运行的 couchdb 实例的主机名。端口是可选的,如果没有指定,则默认为 5984。