java.lang.Object
org.springframework.data.mongodb.core.ReactiveMongoContext
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:
-
Mono.deferContextual(Function)Context
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.ClientSession>Gets theMono<ClientSession>from ReactorContext.static reactor.util.context.ContextsetSession(reactor.util.context.Context context, org.reactivestreams.Publisher<com.mongodb.reactivestreams.client.ClientSession> session) Sets theClientSessioninto the ReactorContext.
-
Constructor Details
-
ReactiveMongoContext
public ReactiveMongoContext()
-
-
Method Details
-
getSession
public static reactor.core.publisher.Mono<com.mongodb.reactivestreams.client.ClientSession> getSession()Gets theMono<ClientSession>from ReactorContext. The resultingMonoemits theClientSessionif a session is associated with the currentsubscriber context. If the context does not contain a session, the resultingMonoterminates empty (i.e. without emitting a value).- Returns:
- the
Monoemitting the client session if present; otherwise theMonoterminates empty.
-
setSession
public static reactor.util.context.Context setSession(reactor.util.context.Context context, org.reactivestreams.Publisher<com.mongodb.reactivestreams.client.ClientSession> session) Sets theClientSessioninto the ReactorContext.- Parameters:
context- must not be null.session- must not be null.- Returns:
- a new
Context. - See Also:
-
Context.put(Object, Object)
-