The central method is transactional, supporting transactional wrapping
of functional sequences code that. This operator handles the transaction lifecycle
and possible exceptions such that neither the ReactiveTransactionCallback
implementation nor the calling code needs to explicitly handle transactions.
Typical usage: Allows for writing low-level data access objects that use resources such as database connections but are not transaction-aware themselves. Instead, they can implicitly participate in transactions handled by higher-level application services utilizing this class, making calls to the low-level services via an inner-class callback object.
Note
Transactional Publishers should avoid Subscription cancellation. See the Cancel Signals section of the Spring Framework reference for more details.
execute, ReactiveTransactionManager
| Modifier and Type | Method and Description |
|---|---|
| public static TransactionalOperator | Returns: the transactional operatorthe transaction management strategy to be used transactionManager)Create a new |
| public static TransactionalOperator | Returns: the transactional operatorthe transaction management strategy to be used transactionManager, TransactionDefinition the transaction definition to apply transactionDefinition)Create a new |
| public <T> Flux | Returns: a result object returned by the callbackthe callback object that specifies the transactional action action)Execute the action specified by the given callback object within a transaction. |
| public default <T> Flux | Returns: a result publisher returned by the callback, ornull if nonethe Flux that should be executed within the transaction flux)Wrap the functional sequence specified by the given Flux within a transaction. |
| public default <T> Mono | Returns: a result publisher returned by the callbackthe Mono that should be executed within the transaction mono)Wrap the functional sequence specified by the given Mono within a transaction. |
| create | back to summary |
|---|---|
| public static TransactionalOperator create(ReactiveTransactionManager transactionManager) Create a new
| |
| create | back to summary |
|---|---|
| public static TransactionalOperator create(ReactiveTransactionManager transactionManager, TransactionDefinition transactionDefinition) Create a new
| |
| execute | back to summary |
|---|---|
| public <T> Flux Execute the action specified by the given callback object within a transaction. Allows for returning a result object created within the transaction, that is, a domain object or a collection of domain objects. A RuntimeException thrown by the callback is treated as a fatal exception that enforces a rollback. Such an exception gets propagated to the caller of the template.
| |
| transactional | back to summary |
|---|---|
| public default <T> Flux Wrap the functional sequence specified by the given Flux within a transaction.
| |
| transactional | back to summary |
|---|---|
| public default <T> Mono Wrap the functional sequence specified by the given Mono within a transaction.
| |