Example usage for org.springframework.transaction.reactive TransactionSynchronizationManager registerSynchronization

List of usage examples for org.springframework.transaction.reactive TransactionSynchronizationManager registerSynchronization

Introduction

In this page you can find the example usage for org.springframework.transaction.reactive TransactionSynchronizationManager registerSynchronization.

Prototype

public void registerSynchronization(TransactionSynchronization synchronization) throws IllegalStateException 

Source Link

Document

Register a new transaction synchronization for the current context.

Usage

From source file:org.springframework.transaction.reactive.AbstractReactiveTransactionManager.java

/**
 * Reactivate transaction synchronization for the current transaction context
 * and resume all given synchronizations.
 * @param synchronizationManager the synchronization manager bound to the current transaction
 * @param suspendedSynchronizations a List of TransactionSynchronization objects
 */// ww  w  .  j av  a2 s .  c o m
private Mono<Void> doResumeSynchronization(TransactionSynchronizationManager synchronizationManager,
        List<TransactionSynchronization> suspendedSynchronizations) {

    synchronizationManager.initSynchronization();
    return Flux.fromIterable(suspendedSynchronizations)
            .concatMap(synchronization -> synchronization.resume()
                    .doOnSuccess(ignore -> synchronizationManager.registerSynchronization(synchronization)))
            .then();
}