Class PersistentApplicationEventMulticaster
java.lang.Object
org.springframework.context.event.AbstractApplicationEventMulticaster
org.springframework.modulith.events.support.PersistentApplicationEventMulticaster
- All Implemented Interfaces:
Aware
,BeanClassLoaderAware
,BeanFactoryAware
,SmartInitializingSingleton
,ApplicationEventMulticaster
,IncompleteEventPublications
public class PersistentApplicationEventMulticaster
extends AbstractApplicationEventMulticaster
implements IncompleteEventPublications, SmartInitializingSingleton
An
ApplicationEventMulticaster
to register EventPublication
s in an
EventPublicationRegistry
so that potentially failing transactional event listeners can get re-invoked upon
application restart or via a schedule.
Republication is handled in afterSingletonsInstantiated()
inspecting the EventPublicationRegistry
for incomplete publications and
- Author:
- Oliver Drotbohm
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static class
First-class collection to work with transactional event listeners, i.e. -
Field Summary
-
Constructor Summary
ConstructorDescriptionPersistentApplicationEventMulticaster
(Supplier<EventPublicationRegistry> registry, Supplier<Environment> environment) Creates a newPersistentApplicationEventMulticaster
for the givenEventPublicationRegistry
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected Collection<ApplicationListener<?>>
getApplicationListeners
(ApplicationEvent event, ResolvableType eventType) void
multicastEvent
(ApplicationEvent event) void
multicastEvent
(ApplicationEvent event, ResolvableType eventType) void
Triggers the re-submission of events for which incompleteEventPublication
s are registered.void
Triggers the re-submission of events for which incompleteEventPublication
s are registered that exceed a certain age regarding their original publication date.Methods inherited from class org.springframework.context.event.AbstractApplicationEventMulticaster
addApplicationListener, addApplicationListenerBean, getApplicationListeners, removeAllListeners, removeApplicationListener, removeApplicationListenerBean, removeApplicationListenerBeans, removeApplicationListeners, setBeanClassLoader, setBeanFactory, supportsEvent, supportsEvent
-
Field Details
-
REPUBLISH_ON_RESTART
- See Also:
-
-
Constructor Details
-
PersistentApplicationEventMulticaster
public PersistentApplicationEventMulticaster(Supplier<EventPublicationRegistry> registry, Supplier<Environment> environment) Creates a newPersistentApplicationEventMulticaster
for the givenEventPublicationRegistry
.- Parameters:
registry
- must not be null.environment
- must not be null.
-
-
Method Details
-
multicastEvent
- Specified by:
multicastEvent
in interfaceApplicationEventMulticaster
-
multicastEvent
- Specified by:
multicastEvent
in interfaceApplicationEventMulticaster
-
getApplicationListeners
protected Collection<ApplicationListener<?>> getApplicationListeners(ApplicationEvent event, ResolvableType eventType) - Overrides:
getApplicationListeners
in classAbstractApplicationEventMulticaster
-
resubmitIncompletePublications
Description copied from interface:IncompleteEventPublications
Triggers the re-submission of events for which incompleteEventPublication
s are registered. Note, that this will materialize all incomplete event publications.- Specified by:
resubmitIncompletePublications
in interfaceIncompleteEventPublications
- Parameters:
filter
- aPredicate
to select the event publications for which to resubmit events.
-
resubmitIncompletePublicationsOlderThan
Description copied from interface:IncompleteEventPublications
Triggers the re-submission of events for which incompleteEventPublication
s are registered that exceed a certain age regarding their original publication date.- Specified by:
resubmitIncompletePublicationsOlderThan
in interfaceIncompleteEventPublications
- Parameters:
duration
- must not be null.
-
afterSingletonsInstantiated
public void afterSingletonsInstantiated()- Specified by:
afterSingletonsInstantiated
in interfaceSmartInitializingSingleton
-