org.springframework.data.mongodb.core

Interface ReactiveSessionScoped



  • public interface ReactiveSessionScoped
    Gateway interface to execute ClientSession bound operations against MongoDB via a ReactiveSessionCallback.
    Since:
    2.1
    Author:
    Christoph Strobl, Mark Paluch
    • Method Detail

      • execute

        default <T> reactor.core.publisher.Flux<T> execute(ReactiveSessionCallback<T> action)
        Executes the given ReactiveSessionCallback within the ClientSession.

        It is up to the caller to make sure the ClientSession is closed when done.

        Type Parameters:
        T - return type.
        Parameters:
        action - callback object that specifies the MongoDB action the callback action. Must not be null.
        Returns:
        a result object returned by the action, can be Flux.empty().
      • execute

        <T> reactor.core.publisher.Flux<T> execute(ReactiveSessionCallback<T> action,
                                                   Consumer<com.mongodb.reactivestreams.client.ClientSession> doFinally)
        Executes the given ReactiveSessionCallback within the ClientSession.

        It is up to the caller to make sure the ClientSession is closed when done.

        Type Parameters:
        T - return type.
        Parameters:
        action - callback object that specifies the MongoDB action the callback action. Must not be null.
        doFinally - callback object that accepts ClientSession after invoking ReactiveSessionCallback. This Consumer is guaranteed to be notified in any case (successful and exceptional outcome of ReactiveSessionCallback).
        Returns:
        a result object returned by the action, can be Flux.empty().