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
ApplicationListener
s. Allows to register those publications, mark
them as completed and lookup incomplete publications.- Author:
- Oliver Drotbohm, Björn Kieling, Dmitry Belyaev
-
Constructor Summary
ConstructorDescriptionCreates a newDefaultEventPublicationRegistry
for the givenEventPublicationRepository
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Returns allEventPublication
s that have not been completed yet.void
markCompleted
(Object event, PublicationTargetIdentifier targetIdentifier) Marks the publication for the given event andPublicationTargetIdentifier
as completed.void
store
(Object event, Stream<PublicationTargetIdentifier> listeners) StoresEventPublication
s for the given event andApplicationListener
s.
-
Constructor Details
-
DefaultEventPublicationRegistry
Creates a newDefaultEventPublicationRegistry
for the givenEventPublicationRepository
.- Parameters:
events
- must not be null.
-
-
Method Details
-
store
Description copied from interface:EventPublicationRegistry
StoresEventPublication
s for the given event andApplicationListener
s.- Specified by:
store
in interfaceEventPublicationRegistry
- Parameters:
event
- must not be null.listeners
- must not be null.
-
findIncompletePublications
Description copied from interface:EventPublicationRegistry
Returns allEventPublication
s that have not been completed yet.- Specified by:
findIncompletePublications
in interfaceEventPublicationRegistry
- Returns:
- will never be null.
-
markCompleted
@Transactional(propagation=REQUIRES_NEW) public void markCompleted(Object event, PublicationTargetIdentifier targetIdentifier) Description copied from interface:EventPublicationRegistry
Marks the publication for the given event andPublicationTargetIdentifier
as completed.- Specified by:
markCompleted
in interfaceEventPublicationRegistry
- Parameters:
event
- must not be null.targetIdentifier
- must not be null.
-
destroy
public void destroy()- Specified by:
destroy
in interfaceDisposableBean
-