public class ReactiveTransactions extends Object
Transactions, allowing transactions to be created and run in an asynchronous
manner.
The main method to run transactions is run(java.util.function.Function<com.couchbase.client.java.transactions.ReactiveTransactionAttemptContext, reactor.core.publisher.Mono<?>>, com.couchbase.client.java.transactions.config.TransactionOptions).
| Constructor and Description |
|---|
ReactiveTransactions(com.couchbase.client.core.Core core,
JsonSerializer serializer) |
| Modifier and Type | Method and Description |
|---|---|
Mono<TransactionResult> |
run(Function<ReactiveTransactionAttemptContext,Mono<?>> transactionLogic)
Convenience overload that runs
run(java.util.function.Function<com.couchbase.client.java.transactions.ReactiveTransactionAttemptContext, reactor.core.publisher.Mono<?>>, com.couchbase.client.java.transactions.config.TransactionOptions) with a default PerTransactionConfig. |
Mono<TransactionResult> |
run(Function<ReactiveTransactionAttemptContext,Mono<?>> transactionLogic,
TransactionOptions options)
Runs the supplied transactional logic until success or failure.
|
@Stability.Internal
public ReactiveTransactions(com.couchbase.client.core.Core core,
JsonSerializer serializer)
public Mono<TransactionResult> run(Function<ReactiveTransactionAttemptContext,Mono<?>> transactionLogic, @Nullable TransactionOptions options)
This is the asynchronous version of Transactions.run(java.util.function.Consumer<com.couchbase.client.java.transactions.TransactionAttemptContext>, com.couchbase.client.java.transactions.config.TransactionOptions), so to cover the differences:
CoreTransactionAttemptContext, which contains asynchronous
methods to allow it to read, mutate, insert and delete documents.Mono<Void>. Any
Flux or Mono can be converted to a Mono<Void> by
calling .then() on it.Mono<TransactionResult>, which should be handled
as a normal Reactor Mono.transactionLogic - the application's transaction logicoptions - the configuration to use for this transactionTransactionResult, as success is implied by the lack of a
thrown exception. It contains information useful only for debugging and logging.TransactionFailedException - or a derived exception if the transaction fails to commit for any reason, possibly
after multiple retries. The exception contains further details of the error.public Mono<TransactionResult> run(Function<ReactiveTransactionAttemptContext,Mono<?>> transactionLogic)
run(java.util.function.Function<com.couchbase.client.java.transactions.ReactiveTransactionAttemptContext, reactor.core.publisher.Mono<?>>, com.couchbase.client.java.transactions.config.TransactionOptions) with a default PerTransactionConfig.Copyright © 2024 Couchbase, Inc.. All rights reserved.