public class Changes
extends java.lang.Object
Contains the Change Notifications API, supports change feeds of types normal and continuous.
// feed type normal
ChangesResult result = dbClient.changes()
.since("seq-value") // *
.limit(10)
.filter("example/filter")
.getChanges();
// feed type continuous
Changes changes = dbClient.changes()
.includeDocs(true)
.heartBeat(30000)
.continuousChanges();
while (changes.hasNext()) {
ChangesResult.Row feed = changes.next();
// changes.stop(); // stop continuous feed
}
* Getting changes since latest update may be obtained by:
CouchDbInfo dbInfo = dbClient.context().info(); String since = dbInfo.getUpdateSeq();
ChangesResult| Modifier and Type | Method and Description |
|---|---|
Changes |
continuousChanges()
Requests Change notifications of feed type continuous.
|
Changes |
filter(java.lang.String filter) |
ChangesResult |
getChanges()
Requests Change notifications of feed type normal.
|
boolean |
hasNext()
Checks whether a feed is available in the continuous stream, blocking
until a feed is received.
|
Changes |
heartBeat(long heartBeat) |
Changes |
includeDocs(boolean includeDocs) |
Changes |
limit(int limit) |
ChangesResult.Row |
next() |
Changes |
since(java.lang.String since) |
void |
stop()
Stops a running continuous feed.
|
Changes |
style(java.lang.String style) |
Changes |
timeout(long timeout) |
public Changes continuousChanges()
Requests Change notifications of feed type continuous.
Feed notifications are accessed in an iterator style.
public boolean hasNext()
public ChangesResult.Row next()
public void stop()
public ChangesResult getChanges()
public Changes since(java.lang.String since)
public Changes limit(int limit)
public Changes heartBeat(long heartBeat)
public Changes timeout(long timeout)
public Changes filter(java.lang.String filter)
public Changes includeDocs(boolean includeDocs)
public Changes style(java.lang.String style)