Class DefaultEventPublicationRegistry
java.lang.Object
org.springframework.modulith.events.DefaultEventPublicationRegistry
- All Implemented Interfaces:
DisposableBean,EventPublicationRegistry
public class DefaultEventPublicationRegistry
extends Object
implements DisposableBean, EventPublicationRegistry
A registry to capture event publications to
ApplicationListeners. Allows to register those publications, mark
them as completed and lookup incomplete publications.- Author:
- Oliver Drotbohm, Björn Kieling, Dmitry Belyaev
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a newDefaultEventPublicationRegistryfor the givenEventPublicationRepository. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Returns allEventPublications that have not been completed yet.voidmarkCompleted(Object event, PublicationTargetIdentifier targetIdentifier) Marks the publication for the given event andPublicationTargetIdentifieras completed.voidstore(Object event, Stream<PublicationTargetIdentifier> listeners) StoresEventPublications for the given event andApplicationListeners.
-
Constructor Details
-
DefaultEventPublicationRegistry
Creates a newDefaultEventPublicationRegistryfor the givenEventPublicationRepository.- Parameters:
events- must not be null.
-
-
Method Details
-
store
Description copied from interface:EventPublicationRegistryStoresEventPublications for the given event andApplicationListeners.- Specified by:
storein interfaceEventPublicationRegistry- Parameters:
event- must not be null.listeners- must not be null.
-
findIncompletePublications
Description copied from interface:EventPublicationRegistryReturns allEventPublications that have not been completed yet.- Specified by:
findIncompletePublicationsin interfaceEventPublicationRegistry- Returns:
- will never be null.
-
markCompleted
@Transactional(propagation=REQUIRES_NEW) public void markCompleted(Object event, PublicationTargetIdentifier targetIdentifier) Description copied from interface:EventPublicationRegistryMarks the publication for the given event andPublicationTargetIdentifieras completed.- Specified by:
markCompletedin interfaceEventPublicationRegistry- Parameters:
event- must not be null.targetIdentifier- must not be null.
-
destroy
public void destroy()- Specified by:
destroyin interfaceDisposableBean
-