public abstract class TransactionContextManager extends Object
Typically used by components that intercept or orchestrate transactional flows such as AOP interceptors or transactional operators.
TransactionSynchronization
Modifier and Type | Method and Description |
---|---|
static Function<reactor.util.context.Context,reactor.util.context.Context> |
createTransactionContext()
Create a
TransactionContext and register it in the subscriber Context . |
static reactor.core.publisher.Mono<TransactionContext> |
currentContext()
Obtain the current
TransactionContext from the subscriber context or the
transactional context holder. |
static Function<reactor.util.context.Context,reactor.util.context.Context> |
getOrCreateContext()
Return a
Function to create or associate a new TransactionContext . |
static Function<reactor.util.context.Context,reactor.util.context.Context> |
getOrCreateContextHolder()
Return a
Function to create or associate a new
TransactionContextHolder . |
public static reactor.core.publisher.Mono<TransactionContext> currentContext() throws NoTransactionException
TransactionContext
from the subscriber context or the
transactional context holder. Context retrieval fails with NoTransactionException
if no context or context holder is registered.TransactionContext
NoTransactionException
- if no TransactionContext was found in the subscriber context
or no context found in a holderpublic static Function<reactor.util.context.Context,reactor.util.context.Context> createTransactionContext()
TransactionContext
and register it in the subscriber Context
.IllegalStateException
- if a transaction context is already associated.Mono.subscriberContext(Function)
,
Flux.subscriberContext(Function)
public static Function<reactor.util.context.Context,reactor.util.context.Context> getOrCreateContext()
Function
to create or associate a new TransactionContext
.
Interaction with transactional resources through
TransactionSynchronizationManager
requires a TransactionContext
to be registered in the subscriber context.public static Function<reactor.util.context.Context,reactor.util.context.Context> getOrCreateContextHolder()
Function
to create or associate a new
TransactionContextHolder
. Creation and release of transactions
within a reactive flow requires a mutable holder that follows a top to
down execution scheme. Reactor's subscriber context follows a down to top
approach regarding mutation visibility.