Class ReactiveMongoContext

java.lang.Object
org.springframework.data.mongodb.core.ReactiveMongoContext

public class ReactiveMongoContext extends Object
ReactiveMongoContext utilizes and enriches the Reactor Context with information potentially required for e.g. ClientSession handling and transactions.
Since:
2.1
Author:
Christoph Strobl, Mark Paluch
See Also:
  • Constructor Details

    • ReactiveMongoContext

      public ReactiveMongoContext()
  • Method Details

    • getSession

      public static Mono<com.mongodb.reactivestreams.client.ClientSession> getSession()
      Gets the Mono<ClientSession> from Reactor Context. The resulting Mono emits the ClientSession if a session is associated with the current subscriber context. If the context does not contain a session, the resulting Mono terminates empty (i.e. without emitting a value).
      Returns:
      the Mono emitting the client session if present; otherwise the Mono terminates empty.
    • setSession

      public static Context setSession(Context context, Publisher<com.mongodb.reactivestreams.client.ClientSession> session)
      Sets the ClientSession into the Reactor Context.
      Parameters:
      context - must not be null.
      session - must not be null.
      Returns:
      a new Context.
      See Also: