Class JdbcEventPublicationRepository
java.lang.Object
org.springframework.modulith.events.jdbc.JdbcEventPublicationRepository
- All Implemented Interfaces:
EventPublicationRepository
JDBC-based repository to store
TargetEventPublications.- Author:
- Dmitry Belyaev, Björn Kieling, Oliver Drotbohm
-
Constructor Summary
ConstructorsConstructorDescriptionJdbcEventPublicationRepository(JdbcOperations operations, EventSerializer serializer, DatabaseType databaseType) Creates a newJdbcEventPublicationRepositoryfor the givenJdbcOperations,EventSerializerandDatabaseType. -
Method Summary
Modifier and TypeMethodDescriptioncreate(TargetEventPublication publication) Persists the givenTargetEventPublication.voidDeletes all publications that were already marked as completed.voiddeleteCompletedPublicationsBefore(Instant instant) Deletes all publication that were already marked as completed with a completion date before the given one.voiddeletePublications(List<UUID> identifiers) Deletes all publications with the given identifiers.Returns all completed event publications currently found in the system.Returns allTargetEventPublications that have not been completed yet.findIncompletePublicationsByEventAndTargetIdentifier(Object event, PublicationTargetIdentifier targetIdentifier) Return the incompleteTargetEventPublicationfor the given serialized event and listener identifier.Returns allTargetEventPublications that have not been completed and were published before the givenInstant.voidmarkCompleted(Object event, PublicationTargetIdentifier identifier, Instant completionDate) Marks the publication for the given event andPublicationTargetIdentifierto be completed at the givenInstant.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.modulith.events.core.EventPublicationRepository
markCompleted
-
Constructor Details
-
JdbcEventPublicationRepository
public JdbcEventPublicationRepository(JdbcOperations operations, EventSerializer serializer, DatabaseType databaseType) Creates a newJdbcEventPublicationRepositoryfor the givenJdbcOperations,EventSerializerandDatabaseType.- Parameters:
operations- must not be null.serializer- must not be null.databaseType- must not be null.
-
-
Method Details
-
create
Description copied from interface:EventPublicationRepositoryPersists the givenTargetEventPublication.- Specified by:
createin 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:EventPublicationRepositoryMarks the publication for the given event andPublicationTargetIdentifierto be completed at the givenInstant.- Specified by:
markCompletedin interfaceEventPublicationRepository- Parameters:
event- must not be null.identifier- must not be null.completionDate- must not be null.
-
findIncompletePublicationsByEventAndTargetIdentifier
@Transactional(readOnly=true) public Optional<TargetEventPublication> findIncompletePublicationsByEventAndTargetIdentifier(Object event, PublicationTargetIdentifier targetIdentifier) Description copied from interface:EventPublicationRepositoryReturn the incompleteTargetEventPublicationfor 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.
-
findCompletedPublications
Description copied from interface:EventPublicationRepositoryReturns all completed event publications currently found in the system.- Specified by:
findCompletedPublicationsin interfaceEventPublicationRepository- Returns:
- will never be null.
-
findIncompletePublications
Description copied from interface:EventPublicationRepositoryReturns allTargetEventPublications that have not been completed yet.- Specified by:
findIncompletePublicationsin interfaceEventPublicationRepository- Returns:
- will never be null.
-
findIncompletePublicationsPublishedBefore
Description copied from interface:EventPublicationRepositoryReturns allTargetEventPublications that have not been completed and were published before the givenInstant.- Specified by:
findIncompletePublicationsPublishedBeforein interfaceEventPublicationRepository- Parameters:
instant- must not be null.- Returns:
- will never be null.
-
deletePublications
Description copied from interface:EventPublicationRepositoryDeletes all publications with the given identifiers.- Specified by:
deletePublicationsin interfaceEventPublicationRepository- Parameters:
identifiers- must not be null.
-
deleteCompletedPublications
public void deleteCompletedPublications()Description copied from interface:EventPublicationRepositoryDeletes all publications that were already marked as completed.- Specified by:
deleteCompletedPublicationsin interfaceEventPublicationRepository
-
deleteCompletedPublicationsBefore
Description copied from interface:EventPublicationRepositoryDeletes all publication that were already marked as completed with a completion date before the given one.- Specified by:
deleteCompletedPublicationsBeforein interfaceEventPublicationRepository- Parameters:
instant- must not be null.
-