Class ChangeStreamEvent<T>

java.lang.Object
org.springframework.data.mongodb.core.ChangeStreamEvent<T>

public class ChangeStreamEvent<T> extends Object
Message implementation specific to MongoDB Change Streams.
Since:
2.1
Author:
Christoph Strobl, Mark Paluch, Myroslav Kosinskyi
  • Constructor Summary

    Constructors
    Constructor
    Description
    ChangeStreamEvent(@Nullable com.mongodb.client.model.changestream.ChangeStreamDocument<org.bson.Document> raw, Class<T> targetType, MongoConverter converter)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(@Nullable Object o)
     
    @Nullable T
    Get the potentially converted ChangeStreamDocument.getFullDocument().
    @Nullable T
    Get the potentially converted document before being changed.
    @Nullable org.bson.BsonTimestamp
    Get the cluster time.
    @Nullable String
    Get the collection name the event was originated at.
    @Nullable String
    Get the database name the event was originated at.
    @Nullable com.mongodb.client.model.changestream.OperationType
    Get the operation type for this event.
    @Nullable com.mongodb.client.model.changestream.ChangeStreamDocument<org.bson.Document>
    Get the raw ChangeStreamDocument as emitted by the driver.
    @Nullable org.bson.BsonValue
    Get the resume token for this event.
    @Nullable Instant
    Get the cluster time as Instant the event was emitted at.
    int
     
     

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ChangeStreamEvent

      public ChangeStreamEvent(@Nullable com.mongodb.client.model.changestream.ChangeStreamDocument<org.bson.Document> raw, Class<T> targetType, MongoConverter converter)
      Parameters:
      raw - can be null.
      targetType - must not be null.
      converter - must not be null.
  • Method Details

    • getRaw

      public @Nullable com.mongodb.client.model.changestream.ChangeStreamDocument<org.bson.Document> getRaw()
      Get the raw ChangeStreamDocument as emitted by the driver.
      Returns:
      can be null.
    • getTimestamp

      public @Nullable Instant getTimestamp()
      Get the cluster time as Instant the event was emitted at.
      Returns:
      can be null.
    • getBsonTimestamp

      public @Nullable org.bson.BsonTimestamp getBsonTimestamp()
      Get the cluster time.
      Returns:
      can be null.
      Since:
      2.2
    • getResumeToken

      public @Nullable org.bson.BsonValue getResumeToken()
      Get the resume token for this event.
      Returns:
      can be null.
    • getOperationType

      public @Nullable com.mongodb.client.model.changestream.OperationType getOperationType()
      Get the operation type for this event.
      Returns:
      can be null.
    • getDatabaseName

      public @Nullable String getDatabaseName()
      Get the database name the event was originated at.
      Returns:
      can be null.
    • getCollectionName

      public @Nullable String getCollectionName()
      Get the collection name the event was originated at.
      Returns:
      can be null.
    • getBody

      public @Nullable T getBody()
      Get the potentially converted ChangeStreamDocument.getFullDocument().
      Returns:
      null when getRaw() or ChangeStreamDocument.getFullDocument() is null.
    • getBodyBeforeChange

      public @Nullable T getBodyBeforeChange()
      Get the potentially converted document before being changed.
      Returns:
      null when getRaw() or ChangeStreamDocument.getFullDocumentBeforeChange() is null.
      Since:
      4.0
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object