public class Changes
extends java.lang.Object
Contains the Change Notifications API, supports normal and continuous feed Changes.
// feed type normal String since = db.info().getUpdateSeq(); // latest update seq ChangesResult changeResult = db.changes() .since(since) .limit(10) .filter("example/filter") .getChanges(); for (ChangesResult.Row row : changeResult.getResults()) { String docId = row.getId() JsonObject doc = row.getDoc(); } // feed type continuous Changes changes = db.changes() .includeDocs(true) .heartBeat(30000) .continuousChanges(); while (changes.hasNext()) { ChangesResult.Row feed = changes.next(); String docId = feed.getId(); JsonObject doc = feed.getDoc(); // changes.stop(); // stop continuous feed }
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()
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 filter(java.lang.String filter)
public Changes heartBeat(long heartBeat)
public Changes timeout(long timeout)
public Changes includeDocs(boolean includeDocs)
public Changes style(java.lang.String style)