Class JpaEventPublicationRepository
java.lang.Object
org.springframework.modulith.events.jpa.JpaEventPublicationRepository
- All Implemented Interfaces:
EventPublicationRepository
Repository to store
EventPublications.- Author:
- Oliver Drotbohm, Dmitry Belyaev, Björn Kieling
-
Constructor Summary
ConstructorsConstructorDescriptionJpaEventPublicationRepository(jakarta.persistence.EntityManager entityManager, EventSerializer serializer) -
Method Summary
Modifier and TypeMethodDescriptioncreate(EventPublication publication) Persists the givenEventPublication.voidDeletes all publications that were already marked as completed.Returns allEventPublicationthat have not been completed yet.findIncompletePublicationsByEventAndTargetIdentifier(Object event, PublicationTargetIdentifier targetIdentifier) Return the incompleteEventPublicationfor the given serialized event and listener identifier.update(CompletableEventPublication publication) Update the data store to mark the backing log entry as completed.
-
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:EventPublicationRepositoryPersists the givenEventPublication.- Specified by:
createin interfaceEventPublicationRepository- Parameters:
publication- must not be null.- Returns:
- will never be null.
-
update
Description copied from interface:EventPublicationRepositoryUpdate the data store to mark the backing log entry as completed.- Specified by:
updatein interfaceEventPublicationRepository- Parameters:
publication- must not be null.- Returns:
- will never be null.
-
findIncompletePublications
Description copied from interface:EventPublicationRepositoryReturns allEventPublicationthat have not been completed yet.- Specified by:
findIncompletePublicationsin interfaceEventPublicationRepository- Returns:
- will never be null.
-
findIncompletePublicationsByEventAndTargetIdentifier
@Transactional(readOnly=true) public Optional<EventPublication> findIncompletePublicationsByEventAndTargetIdentifier(Object event, PublicationTargetIdentifier targetIdentifier) Description copied from interface:EventPublicationRepositoryReturn the incompleteEventPublicationfor the given serialized event and listener identifier.- Specified by:
findIncompletePublicationsByEventAndTargetIdentifierin interfaceEventPublicationRepository- Parameters:
event- must not be null.targetIdentifier- must not be null.- Returns:
- will never be null.
-
deleteCompletedPublications
Description copied from interface:EventPublicationRepositoryDeletes all publications that were already marked as completed.- Specified by:
deleteCompletedPublicationsin interfaceEventPublicationRepository
-