Interface Transaction

    • Method Detail

      • commit

        io.reactivex.rxjava3.core.Completable commit()
        Commits the current transaction and close transactional connection.
        Returns:
        the Completable that 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 Completable that 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 Completable that indicates that the save point has been rolled back to
        Throws:
        UnsupportedOperationException - if save points are not supported
        IllegalArgumentException - 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 returned Maybe
        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 returned Single
        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 returned Flowable
        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 Completable that indicates that the save point has been created
        Throws:
        UnsupportedOperationException - if save points are not supported
        IllegalArgumentException - 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 Completable that indicates that the save point has been released
        Throws:
        IllegalArgumentException - if the specified save point is invalid