Class JpaEventPublicationRepository
java.lang.Object
org.springframework.modulith.events.jpa.JpaEventPublicationRepository
- All Implemented Interfaces:
EventPublicationRepository
Repository to store
EventPublication
s.- Author:
- Oliver Drotbohm, Dmitry Belyaev, Björn Kieling
-
Constructor Summary
ConstructorDescriptionJpaEventPublicationRepository
(jakarta.persistence.EntityManager entityManager, EventSerializer serializer) -
Method Summary
Modifier and TypeMethodDescriptioncreate
(EventPublication publication) Persists the givenEventPublication
.void
Deletes all publications that were already marked as completed.void
deleteCompletedPublicationsBefore
(Instant instant) Deletes all publication that were already marked as completed with a completion date before the given one.Returns allEventPublication
that have not been completed yet.findIncompletePublicationsByEventAndTargetIdentifier
(Object event, PublicationTargetIdentifier targetIdentifier) Return the incompleteEventPublication
for the given serialized event and listener identifier.void
markCompleted
(Object event, PublicationTargetIdentifier identifier, Instant completionDate) Marks the publication for the given event andPublicationTargetIdentifier
to be completed at the givenInstant
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.springframework.modulith.events.core.EventPublicationRepository
markCompleted
-
Constructor Details
-
JpaEventPublicationRepository
public JpaEventPublicationRepository(jakarta.persistence.EntityManager entityManager, EventSerializer serializer) - Parameters:
entityManager
- must not be null.serializer
- must not be null.
-
-
Method Details
-
create
Description copied from interface:EventPublicationRepository
Persists the givenEventPublication
.- Specified by:
create
in interfaceEventPublicationRepository
- Parameters:
publication
- must not be null.- Returns:
- will never be null.
-
markCompleted
@Transactional public void markCompleted(Object event, PublicationTargetIdentifier identifier, Instant completionDate) Description copied from interface:EventPublicationRepository
Marks the publication for the given event andPublicationTargetIdentifier
to be completed at the givenInstant
.- Specified by:
markCompleted
in interfaceEventPublicationRepository
- Parameters:
event
- must not be null.identifier
- must not be null.completionDate
- must not be null.
-
findIncompletePublications
Description copied from interface:EventPublicationRepository
Returns allEventPublication
that have not been completed yet.- Specified by:
findIncompletePublications
in interfaceEventPublicationRepository
- Returns:
- will never be null.
-
findIncompletePublicationsByEventAndTargetIdentifier
@Transactional(readOnly=true) public Optional<EventPublication> findIncompletePublicationsByEventAndTargetIdentifier(Object event, PublicationTargetIdentifier targetIdentifier) Description copied from interface:EventPublicationRepository
Return the incompleteEventPublication
for the given serialized event and listener identifier.- Specified by:
findIncompletePublicationsByEventAndTargetIdentifier
in interfaceEventPublicationRepository
- Parameters:
event
- must not be null.targetIdentifier
- must not be null.- Returns:
- will never be null.
-
deleteCompletedPublications
Description copied from interface:EventPublicationRepository
Deletes all publications that were already marked as completed.- Specified by:
deleteCompletedPublications
in interfaceEventPublicationRepository
-
deleteCompletedPublicationsBefore
Description copied from interface:EventPublicationRepository
Deletes all publication that were already marked as completed with a completion date before the given one.- Specified by:
deleteCompletedPublicationsBefore
in interfaceEventPublicationRepository
- Parameters:
instant
- must not be null.
-