public class TransactionAwareEventPublisher extends DelegatingMultiEventPublisher implements com.atlassian.event.api.EventPublisher, MultiEventPublisher
Note that any transactional operations done in afterCommit(), need to be wrapped in a PROPAGATION_REQUIRES_NEW transaction,
(see TransactionSynchronization.afterCommit()). This is guaranteed by
TransactionAwareEventDispatcher
Since publishing an event during a transaction causes a TransactionSynchronization
to be registered for cases where many events are sent at once, it makes sense to use publishAll(Collection), to wrap them
in a single TransactionSynchronization, as transaction performance degrades notably with the number of distinct synchronizations registered.
delegate| Modifier and Type | Method and Description |
|---|---|
void |
publish(Object event) |
void |
publishAll(Collection<Object> events)
Publish events that will be consumed by their respective registered listeners.
|
register, unregister, unregisterAllpublic void publish(Object event)
publish in interface com.atlassian.event.api.EventPublisherpublish in class DelegatingMultiEventPublisherpublic void publishAll(Collection<Object> events)
MultiEventPublisherEventPublisher.publish(Object) for every event in the collection.publishAll in interface MultiEventPublisherpublishAll in class DelegatingMultiEventPublisherCopyright © 2023 Atlassian. All rights reserved.