org.springframework.data.mongodb.core

Class ChangeStreamEvent<T>



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

      • 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 Detail

      • getRaw

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

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

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

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

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

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

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

        protected boolean canEqual(Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object