Class DocumentChange

java.lang.Object
com.couchbase.client.dcp.highlevel.DocumentChange
All Implemented Interfaces:
DatabaseChangeEvent, FlowControllable
Direct Known Subclasses:
Deletion, Mutation

public abstract class DocumentChange extends Object implements DatabaseChangeEvent, FlowControllable
  • Constructor Details

  • 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

      public Map<String,String> 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: DatabaseChangeEvent
      Returns 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:
      getVbucket in interface DatabaseChangeEvent
    • getOffset

      public StreamOffset getOffset()
    • getKey

      public String getKey()
    • getQualifiedKey

      public String getQualifiedKey()
      Returns the document key prefixed by the names of the containing scope and collection.
    • getCollection

      public CollectionsManifest.CollectionInfo getCollection()
    • isMutation

      public boolean isMutation()
    • getRevision

      public long getRevision()
    • getCas

      public long getCas()
    • getTimestamp

      public Instant 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.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.

      Specified by:
      flowControlAck in interface FlowControllable
    • toString

      public String toString()
      Overrides:
      toString in class Object