public abstract class DocumentChange extends Object implements DatabaseChangeEvent, FlowControllable
| Constructor and Description |
|---|
DocumentChange(io.netty.buffer.ByteBuf byteBuf,
CollectionsManifest.CollectionInfo collectionInfo,
String key,
FlowControlReceipt receipt,
StreamOffset offset) |
| Modifier and Type | Method and Description |
|---|---|
void |
flowControlAck()
Removes the backpressure generated by this event, allowing the server
to send more data.
|
long |
getCas() |
CollectionsManifest.CollectionInfo |
getCollection() |
byte[] |
getContent() |
String |
getKey() |
StreamOffset |
getOffset() |
String |
getQualifiedKey()
Returns the document key prefixed by the names of the containing scope and collection.
|
long |
getRevision() |
Instant |
getTimestamp()
Returns the time the change occurred.
|
long |
getTracingToken()
Returns an opaque tracing token that uniquely identifies this change
within the current run of the JVM.
|
int |
getVbucket()
Returns the id of the virtual bucket associated with this event,
or -1 if the event is not associated with a specific virtual bucket.
|
Map<String,String> |
getXattrs()
Returns the document's extended attributes (XATTRS) as a map.
|
boolean |
isMutation() |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdispatchpublic DocumentChange(io.netty.buffer.ByteBuf byteBuf,
CollectionsManifest.CollectionInfo collectionInfo,
String key,
FlowControlReceipt receipt,
StreamOffset offset)
public long getTracingToken()
Useful for correlating lifecycle log messages.
public Map<String,String> getXattrs()
The keys are the attribute names, and the values are the corresponding attribute values encoded as JSON.
If the DCP client was not initialized to request extended attributes, this method always returns an empty map.
Client.Builder.xattrs(boolean)public byte[] getContent()
public int getVbucket()
DatabaseChangeEventgetVbucket in interface DatabaseChangeEventpublic StreamOffset getOffset()
public String getKey()
public String getQualifiedKey()
public CollectionsManifest.CollectionInfo getCollection()
public boolean isMutation()
public long getRevision()
public long getCas()
public Instant getTimestamp()
CAVEAT: In order for the timestamp in the CAS to be reliable, the bucket must have been created by Couchbase Server 4.6 or later, and the document change must have been performed by Couchbase Server 7.0 or later. Even then, it's possible for a set_with_meta operation to assign an arbitrary CAS value (and therefore timestamp) to a document.
public void flowControlAck()
If flow control is enabled on the client, then non-blocking listeners
and listeners using FlowControlMode.MANUAL MUST call
this method when the application is ready to receive more data
(usually when the app has finished processing the event),
otherwise the server will stop sending events.
This method is idempotent; if it is called more than once, any calls after the first are ignored.
flowControlAck in interface FlowControllableCopyright © 2021 Couchbase, Inc.. All rights reserved.