Class TransactionalEventPublisher
java.lang.Object
org.springframework.transaction.reactive.TransactionalEventPublisher
A delegate for publishing transactional events in a reactive setup.
 Includes the current Reactor-managed 
TransactionContext as
 a source object for every ApplicationEvent to be published.
 This delegate is just a convenience. The current TransactionContext
 can be directly included as the event source as well, and then published
 through an ApplicationEventPublisher such as the Spring
 ApplicationContext:
 
 TransactionContextManager.currentContext()
     .map(source -> new PayloadApplicationEvent<>(source, "myPayload"))
     .doOnSuccess(this.eventPublisher::publishEvent)
 - Since:
- 6.1
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionTransactionalEventPublisher(ApplicationEventPublisher eventPublisher) Create a new delegate for publishing transactional events in a reactive setup.
- 
Method SummaryModifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>publishEvent(Object payload) Publish an event created for the given payload.reactor.core.publisher.Mono<Void>publishEvent(Function<TransactionContext, ApplicationEvent> eventCreationFunction) Publish an event created through the given function which maps the transaction source object (theTransactionContext) to the event instance.
- 
Constructor Details- 
TransactionalEventPublisherCreate a new delegate for publishing transactional events in a reactive setup.- Parameters:
- eventPublisher- the actual event publisher to use, typically a Spring- ApplicationContext
 
 
- 
- 
Method Details- 
publishEventpublic reactor.core.publisher.Mono<Void> publishEvent(Function<TransactionContext, ApplicationEvent> eventCreationFunction) Publish an event created through the given function which maps the transaction source object (theTransactionContext) to the event instance.- Parameters:
- eventCreationFunction- a function mapping the source object to the event instance, for example,- source -> new PayloadApplicationEvent<>(source, "myPayload")
- Returns:
- the Reactor Monofor the transactional event publication
 
- 
publishEventPublish an event created for the given payload.- Parameters:
- payload- the payload to publish as an event
- Returns:
- the Reactor Monofor the transactional event publication
 
 
-