Interface EventPublication
- All Superinterfaces:
Comparable<EventPublication>
,Completable
- All Known Implementing Classes:
DefaultEventPublication
An event publication.
- Author:
- Oliver Drotbohm, Björn Kieling, Dmitry Belyaev
-
Method Summary
Modifier and TypeMethodDescriptiondefault int
compareTo
(EventPublication that) default ApplicationEvent
Returns the event as SpringApplicationEvent
, effectively wrapping it into aPayloadApplicationEvent
in case it's not one already.Returns the completion date of the publication.getEvent()
Returns the event that is published.Returns a unique identifier for this publication.Returns the time the event is published at.Returns the identifier of the target that the event is supposed to be published to.default boolean
isIdentifiedBy
(PublicationTargetIdentifier identifier) Returns whether the publication is identified by the givenPublicationTargetIdentifier
.default boolean
Returns whether the publication of the event has completed.static EventPublication
of
(Object event, PublicationTargetIdentifier id) Creates aEventPublication
for the given event an listener identifier using a defaultInstant
.static EventPublication
of
(Object event, PublicationTargetIdentifier id, Instant publicationDate) Creates aEventPublication
for the given event an listener identifier and publication date.Methods inherited from interface org.springframework.modulith.events.core.Completable
markCompleted
-
Method Details
-
of
Creates aEventPublication
for the given event an listener identifier using a defaultInstant
. Prefer usingof(Object, PublicationTargetIdentifier, Instant)
with a dedicatedInstant
obtained from aClock
.- Parameters:
event
- must not be null.id
- must not be null.- Returns:
- will never be null.
- See Also:
-
of
Creates aEventPublication
for the given event an listener identifier and publication date.- Parameters:
event
- must not be null.id
- must not be null.publicationDate
- must not be null.- Returns:
- will never be null.
-
getIdentifier
UUID getIdentifier()Returns a unique identifier for this publication.- Returns:
- will never be null.
-
getEvent
Object getEvent()Returns the event that is published.- Returns:
-
getApplicationEvent
Returns the event as SpringApplicationEvent
, effectively wrapping it into aPayloadApplicationEvent
in case it's not one already.- Returns:
-
getPublicationDate
Instant getPublicationDate()Returns the time the event is published at.- Returns:
-
getTargetIdentifier
PublicationTargetIdentifier getTargetIdentifier()Returns the identifier of the target that the event is supposed to be published to.- Returns:
-
isIdentifiedBy
Returns whether the publication is identified by the givenPublicationTargetIdentifier
.- Parameters:
identifier
- must not be null.- Returns:
-
getCompletionDate
Returns the completion date of the publication.- Returns:
- will never be null.
-
isPublicationCompleted
default boolean isPublicationCompleted()Returns whether the publication of the event has completed.- Returns:
- will never be null.
-
compareTo
- Specified by:
compareTo
in interfaceComparable<EventPublication>
-