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
org.:
TransactionContextManager.currentContext()
.map(source -> new PayloadApplicationEvent<>(source, "myPayload"))
.doOnSuccess(this.eventPublisher::publishEvent)
publishEvent(Function), publishEvent(Object), ApplicationEventPublisher
| Modifier and Type | Field and Description |
|---|---|
| private final ApplicationEventPublisher |
| Access | Constructor and Description |
|---|---|
| public | TransactionalEventPublisher(ApplicationEventPublisher
the actual event publisher to use,
typically a Spring eventPublisher)org.Create a new delegate for publishing transactional events in a reactive setup. |
| Modifier and Type | Method and Description |
|---|---|
| public Mono | Returns: the ReactorMono for the transactional event publicationa function mapping the source object to the event instance,
e.g. eventCreationFunction)source -> new PayloadApplicationEvent<>(source, "myPayload")Publish an event created through the given function which maps the transaction
source object (the |
| public Mono | Returns: the ReactorMono for the transactional event publicationthe payload to publish as an event payload)Publish an event created for the given payload. |
| eventPublisher | back to summary |
|---|---|
| private final ApplicationEventPublisher eventPublisher | |
| TransactionalEventPublisher | back to summary |
|---|---|
| public TransactionalEventPublisher(ApplicationEventPublisher eventPublisher) Create a new delegate for publishing transactional events in a reactive setup.
| |
| publishEvent | back to summary |
|---|---|
| public Mono Publish an event created through the given function which maps the transaction
source object (the
| |
| publishEvent | back to summary |
|---|---|
| public Mono Publish an event created for the given payload. | |