Class DocumentChange
- All Implemented Interfaces:
DatabaseChangeEvent,FlowControllable
-
Constructor Summary
ConstructorsConstructorDescriptionDocumentChange(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf byteBuf, CollectionsManifest.CollectionInfo collectionInfo, String key, FlowControlReceipt receipt, StreamOffset offset) -
Method Summary
Modifier and TypeMethodDescriptionvoidRemoves the backpressure generated by this event, allowing the server to send more data.longgetCas()byte[]getKey()Returns the document key prefixed by the names of the containing scope and collection.longReturns the time the change occurred.longReturns an opaque tracing token that uniquely identifies this change within the current run of the JVM.intReturns the id of the virtual bucket associated with this event, or -1 if the event is not associated with a specific virtual bucket.Returns the document's extended attributes (XATTRS) as a map.booleantoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.couchbase.client.dcp.highlevel.internal.DatabaseChangeEvent
dispatch
-
Constructor Details
-
DocumentChange
public DocumentChange(com.couchbase.client.core.deps.io.netty.buffer.ByteBuf byteBuf, CollectionsManifest.CollectionInfo collectionInfo, String key, FlowControlReceipt receipt, StreamOffset offset)
-
-
Method Details
-
getTracingToken
public long getTracingToken()Returns an opaque tracing token that uniquely identifies this change within the current run of the JVM.Useful for correlating lifecycle log messages.
-
getXattrs
Returns the document's extended attributes (XATTRS) as a map.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.
- See Also:
-
getContent
public byte[] getContent() -
getVbucket
public int getVbucket()Description copied from interface:DatabaseChangeEventReturns the id of the virtual bucket associated with this event, or -1 if the event is not associated with a specific virtual bucket.- Specified by:
getVbucketin interfaceDatabaseChangeEvent
-
getOffset
-
getKey
-
getQualifiedKey
Returns the document key prefixed by the names of the containing scope and collection. -
getCollection
-
isMutation
public boolean isMutation() -
getRevision
public long getRevision() -
getCas
public long getCas() -
getTimestamp
Returns the time the change occurred.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.
-
flowControlAck
public void flowControlAck()Removes the backpressure generated by this event, allowing the server to send more data.If flow control is enabled on the client, then non-blocking listeners and listeners using
FlowControlMode.MANUALMUST 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.
- Specified by:
flowControlAckin interfaceFlowControllable
-
toString
-