This component is now included in camel as part of http://camel.apache.org/camel-2110-release.html.
The camel-couchdb component allows you to treat Apache CouchDB as a producer or consumer of messages. Using the lightweight LightCouch API, this camel component has the following features:
- As a consumer, monitors couch changesets for inserts, updates and deletes and publishes these as messages into camel routes.
- As a producer, can save or update documents into couch.
- Can support as many endpoints as required, eg for multiple databases across multiple instances.
- Ability to have events trigger for only deletes, only inserts/updates or all (default).
- Headers set for sequenceId, document revision, document id, and HTTP method type.
How to Use
You can use couch as an endpoint with the following URI. The endpoint URI is the same for producer and consumer.
Some of the available options are:
- deletes document deletes are published as events (default true)
- updates document inserts/updates are published as events (default true)
- heartbeat how often to send an empty message to keep socket alive (default 30000ms)
- createDatabase create the database if it does not already exist (default false)
- username username in case of authenticated databases (default null)
- password password for authenticated databases (default null)
Messages published into the system have the following metadata applied in the form of headers on the exchange:
- CouchDbDatabase - the database the message came from
- CouchDbSeq - the couchdb changeset sequence number of the update / delete message
- CouchDbId - the couchdb document id
- CouchDbRev - the couchdb document revision
- CouchDbMethod - the method (delete / update)
camel-couchdb has a complete set of unit tests. In addition there are some integration tests that require you to run a local instance of Couch. By default the tests will look at localhost:5984 and for a database called camelcouchdb.
This software is licensed under the Apache 2 license, quoted below. Copyright 2013 Stephen Samuel Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.