Interface TransactionalApplicationListener<E extends ApplicationEvent>

Type Parameters:
E - the specific ApplicationEvent subclass to listen to
All Superinterfaces:
ApplicationListener<E>, EventListener, Ordered
All Known Implementing Classes:
TransactionalApplicationListenerAdapter, TransactionalApplicationListenerMethodAdapter

public interface TransactionalApplicationListener<E extends ApplicationEvent> extends ApplicationListener<E>, Ordered
An ApplicationListener that is invoked according to a TransactionPhase. This is a programmatic equivalent of the TransactionalEventListener annotation.

Adding Ordered to your listener implementation allows you to prioritize that listener amongst other listeners running before or after transaction completion.

As of 6.1, transactional event listeners can work with thread-bound transactions managed by a PlatformTransactionManager as well as reactive transactions managed by a ReactiveTransactionManager. For the former, listeners are guaranteed to see the current thread-bound transaction. Since the latter uses the Reactor context instead of thread-local variables, the transaction context needs to be included in the published event instance as the event source: see TransactionalEventPublisher.

Since:
5.3
Author:
Juergen Hoeller, Oliver Drotbohm
See Also: