Class JdbcEventPublicationRepository
java.lang.Object
org.springframework.modulith.events.jdbc.JdbcEventPublicationRepository
- All Implemented Interfaces:
EventPublicationRepository
JDBC-based repository to store
EventPublication
s.- Author:
- Dmitry Belyaev, Björn Kieling, Oliver Drotbohm
-
Constructor Summary
ConstructorDescriptionJdbcEventPublicationRepository
(JdbcOperations operations, EventSerializer serializer, DatabaseType databaseType) Creates a newJdbcEventPublicationRepository
for the givenJdbcOperations
,EventSerializer
andDatabaseType
. -
Method Summary
Modifier and TypeMethodDescriptioncreate
(EventPublication publication) Persists the givenEventPublication
.void
Deletes all publications that were already marked as completed.Returns allEventPublication
that have not been completed yet.findIncompletePublicationsByEventAndTargetIdentifier
(Object event, PublicationTargetIdentifier targetIdentifier) Return the incompleteEventPublication
for the given serialized event and listener identifier.update
(CompletableEventPublication publication) Update the data store to mark the backing log entry as completed.
-
Constructor Details
-
JdbcEventPublicationRepository
public JdbcEventPublicationRepository(JdbcOperations operations, EventSerializer serializer, DatabaseType databaseType) Creates a newJdbcEventPublicationRepository
for the givenJdbcOperations
,EventSerializer
andDatabaseType
.- Parameters:
operations
- must not be null.serializer
- must not be null.databaseType
- 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.
-
update
Description copied from interface:EventPublicationRepository
Update the data store to mark the backing log entry as completed.- Specified by:
update
in interfaceEventPublicationRepository
- Parameters:
publication
- must not be null.- 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.
-
findIncompletePublications
Description copied from interface:EventPublicationRepository
Returns allEventPublication
that have not been completed yet.- Specified by:
findIncompletePublications
in interfaceEventPublicationRepository
- Returns:
- will never be null.
-
deleteCompletedPublications
public void deleteCompletedPublications()Description copied from interface:EventPublicationRepository
Deletes all publications that were already marked as completed.- Specified by:
deleteCompletedPublications
in interfaceEventPublicationRepository
-