{note} This only works with CouchDB >= 0.10.0 and is still an experimental feature in couch4j.{note}
The {{Database.addChangeListener}} method allows you to register ChangeListeners. A {{ChangeEvent}} will be delivered whenever the database changes. The implementation currently only supports the [*continuous* change API|http://books.couchdb.org/relax/reference/change-notifications#Continuous%20Changes]. An overloaded method will be added that allows the client to define the update sequence to start with.
{code:java}
CouchDbClient server = new DefaultCouchDbClient();
Database database = server.getDatabase("couch4j");
database.addChangeListener(new ChangeListener() {
public void onChange(ChangeEvent event) {
System.out.println(event);
}
});
// This or *any other change* to the couch4j CouchDB database will trigger a change event.
database.saveDocument(new Document("test-1"));
{code}
h3. Reference
* http://books.couchdb.org/relax/reference/change-notifications