org.springframework.data.mongodb.core

Interface ReactiveSessionCallback<T>

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.


    @FunctionalInterface
    public interface ReactiveSessionCallback<T>
    Callback interface for executing operations within a ClientSession using reactive infrastructure.
    Since:
    2.1
    Author:
    Christoph Strobl
    See Also:
    ClientSession
    • Method Detail

      • doInSession

        org.reactivestreams.Publisher<T> doInSession(ReactiveMongoOperations operations)
        Execute operations against a MongoDB instance via session bound ReactiveMongoOperations. The session is inferred directly into the operation so that no further interaction is necessary.

        Please note that only Spring Data-specific abstractions like ReactiveMongoOperations.find(Query, Class) and others are enhanced with the ClientSession. When obtaining plain MongoDB gateway objects like MongoCollection or MongoDatabase via eg. ReactiveMongoOperations.getCollection(String) we leave responsibility for ClientSession again up to the caller.

        Parameters:
        operations - will never be null.
        Returns:
        never null.