-
public interface TransactionCurrent implementation delegates all method calls toio.r2dbc.spi.Connection, but in future this API can be extended by using other SPI.- Since:
- 0.1
- Author:
- nedis
- See Also:
TransactionType,Transaction,Transaction,SavePoint,IsolationLevel
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description io.reactivex.rxjava3.core.Completablecommit()Commits the current transaction and close transactional connection.io.reactivex.rxjava3.core.Completablecreate(SavePoint savePoint)Creates the save point in the current transaction.default io.reactivex.rxjava3.functions.Function<? super Throwable,? extends io.reactivex.rxjava3.core.CompletableSource>createRollbackThenReturnCompletableErrorFallback()This factory method allows simplifying the setting of the error handler.default <T> io.reactivex.rxjava3.functions.Function<? super Throwable,? extends org.reactivestreams.Publisher<? extends T>>createRollbackThenReturnFlowableErrorFallback()This factory method allows simplifying the setting of the error handler.default <T> io.reactivex.rxjava3.functions.Function<? super Throwable,? extends io.reactivex.rxjava3.core.MaybeSource<? extends T>>createRollbackThenReturnMaybeErrorFallback()This factory method allows simplifying the setting of the error handler.default <T> io.reactivex.rxjava3.functions.Function<? super Throwable,? extends io.reactivex.rxjava3.core.SingleSource<? extends T>>createRollbackThenReturnSingleErrorFallback()This factory method allows simplifying the setting of the error handler.IsolationLevelgetIsolationLevel()Returns theIsolationLevelfor this connection.io.reactivex.rxjava3.core.Completablerelease(SavePoint savePoint)Releases the save point in the current transaction.io.reactivex.rxjava3.core.Completablerollback()Rolls back the current transaction and close transactional connection.io.reactivex.rxjava3.core.Completablerollback(SavePoint savePoint)Rolls back to the save point in the current transaction.io.reactivex.rxjava3.core.CompletablesetIsolationLevel(IsolationLevel isolationLevel)Configures the isolation level for the current transaction.
-
-
-
Method Detail
-
commit
io.reactivex.rxjava3.core.Completable commit()
Commits the current transaction and close transactional connection.- Returns:
- the
Completablethat indicates that the transaction has been committed and the connection has been closed.
-
rollback
io.reactivex.rxjava3.core.Completable rollback()
Rolls back the current transaction and close transactional connection.- Returns:
- the
Completablethat indicates that the transaction has been rolled back and the connection has been closed.
-
rollback
io.reactivex.rxjava3.core.Completable rollback(SavePoint savePoint)
Rolls back to the save point in the current transaction.- Parameters:
savePoint- the save point to rollback to- Returns:
- the
Completablethat indicates that the save point has been rolled back to - Throws:
UnsupportedOperationException- if save points are not supportedIllegalArgumentException- if the specified save point is invalid
-
createRollbackThenReturnMaybeErrorFallback
default <T> io.reactivex.rxjava3.functions.Function<? super Throwable,? extends io.reactivex.rxjava3.core.MaybeSource<? extends T>> createRollbackThenReturnMaybeErrorFallback()
This factory method allows simplifying the setting of the error handler.Instead of long fragment:
.onErrorResumeNext(e -> transaction.rollback() .andThen(Maybe.error(e)) )You can use the shortest version:
.onErrorResumeNext(transaction.createRollbackThenReturnMaybeErrorFallback());- Type Parameters:
T- the type of the single value of returnedMaybe- Returns:
- the function that handles errors
- See Also:
Maybe.onErrorResumeNext(Function)
-
createRollbackThenReturnSingleErrorFallback
default <T> io.reactivex.rxjava3.functions.Function<? super Throwable,? extends io.reactivex.rxjava3.core.SingleSource<? extends T>> createRollbackThenReturnSingleErrorFallback()
This factory method allows simplifying the setting of the error handler.Instead of long fragment:
.onErrorResumeNext(e -> transaction.rollback() .andThen(Single.error(e)) )You can use the shortest version:
.onErrorResumeNext(transaction.createRollbackThenReturnSingleErrorFallback());- Type Parameters:
T- the type of the single value of returnedSingle- Returns:
- the function that handles errors
- See Also:
Single.onErrorResumeNext(Function)
-
createRollbackThenReturnCompletableErrorFallback
default io.reactivex.rxjava3.functions.Function<? super Throwable,? extends io.reactivex.rxjava3.core.CompletableSource> createRollbackThenReturnCompletableErrorFallback()
This factory method allows simplifying the setting of the error handler.Instead of long fragment:
.onErrorResumeNext(e -> transaction.rollback() .andThen(Completable.error(e)) )You can use the shortest version:
.onErrorResumeNext(transaction.createRollbackThenReturnCompletableErrorFallback());- Returns:
- the function that handles errors
- See Also:
Completable.onErrorResumeNext(Function)
-
createRollbackThenReturnFlowableErrorFallback
default <T> io.reactivex.rxjava3.functions.Function<? super Throwable,? extends org.reactivestreams.Publisher<? extends T>> createRollbackThenReturnFlowableErrorFallback()
This factory method allows simplifying the setting of the error handler.Instead of long fragment:
.onErrorResumeNext(e -> transaction.rollback() .andThen(Flowable.error(e)) )You can use the shortest version:
.onErrorResumeNext(transaction.createRollbackThenReturnFlowableErrorFallback());- Type Parameters:
T- the type of the single value of returnedFlowable- Returns:
- the function that handles errors
- See Also:
Flowable.onErrorResumeNext(Function)
-
create
io.reactivex.rxjava3.core.Completable create(SavePoint savePoint)
Creates the save point in the current transaction.- Parameters:
savePoint- the save point to create- Returns:
- the
Completablethat indicates that the save point has been created - Throws:
UnsupportedOperationException- if save points are not supportedIllegalArgumentException- if the specified save point is invalid
-
release
io.reactivex.rxjava3.core.Completable release(SavePoint savePoint)
Releases the save point in the current transaction. Calling this for drivers not supporting save point release results in a no-op.- Parameters:
savePoint- the save point to release- Returns:
- the
Completablethat indicates that the save point has been released - Throws:
IllegalArgumentException- if the specified save point is invalid
-
getIsolationLevel
IsolationLevel getIsolationLevel()
Returns theIsolationLevelfor this connection.Isolation level is typically one of the following constants:
- Returns:
- the
IsolationLevelfor this connection.
-
setIsolationLevel
io.reactivex.rxjava3.core.Completable setIsolationLevel(IsolationLevel isolationLevel)
Configures the isolation level for the current transaction.Isolation level is typically one of the following constants:
- Parameters:
isolationLevel- the isolation level for this transaction- Returns:
- the
Completablethat indicates that the transaction level has been configured - Throws:
NullPointerException- ifisolationLevelisnull
-
-