Change notifications

Skip to end of metadata
Go to start of metadata
This only works with CouchDB >= 0.10.0 and is still an experimental feature in couch4j.

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. An overloaded method will be added that allows the client to define the update sequence to start with.

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"));

Reference

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Anonymous replies:

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account. You can also Sign Up for a new account.