Class JpaEventPublicationRepository

java.lang.Object
org.springframework.modulith.events.jpa.JpaEventPublicationRepository
All Implemented Interfaces:
org.springframework.modulith.events.core.EventPublicationRepository

@Transactional @Repository class JpaEventPublicationRepository extends Object implements org.springframework.modulith.events.core.EventPublicationRepository
Repository to store TargetEventPublications.
Author:
Oliver Drotbohm, Dmitry Belyaev, Björn Kieling, Cora Iberkleid
  • Constructor Details

    • JpaEventPublicationRepository

      public JpaEventPublicationRepository(jakarta.persistence.EntityManager entityManager, org.springframework.modulith.events.core.EventSerializer serializer, org.springframework.modulith.events.support.CompletionMode completionMode)
      Creates a new JpaEventPublicationRepository for the given EntityManager and EventSerializer.
      Parameters:
      entityManager - must not be null.
      serializer - must not be null.
  • Method Details

    • create

      public org.springframework.modulith.events.core.TargetEventPublication create(org.springframework.modulith.events.core.TargetEventPublication publication)
      Specified by:
      create in interface org.springframework.modulith.events.core.EventPublicationRepository
    • markProcessing

      public void markProcessing(UUID identifier)
      Specified by:
      markProcessing in interface org.springframework.modulith.events.core.EventPublicationRepository
    • markCompleted

      public void markCompleted(Object event, org.springframework.modulith.events.core.PublicationTargetIdentifier identifier, Instant completionDate)
      Specified by:
      markCompleted in interface org.springframework.modulith.events.core.EventPublicationRepository
    • markCompleted

      public void markCompleted(UUID identifier, Instant completionDate)
      Specified by:
      markCompleted in interface org.springframework.modulith.events.core.EventPublicationRepository
    • markFailed

      public void markFailed(UUID identifier)
      Specified by:
      markFailed in interface org.springframework.modulith.events.core.EventPublicationRepository
    • markResubmitted

      public boolean markResubmitted(UUID identifier, Instant resubmissionDate)
      Specified by:
      markResubmitted in interface org.springframework.modulith.events.core.EventPublicationRepository
    • findIncompletePublications

      @Transactional(readOnly=true) public List<org.springframework.modulith.events.core.TargetEventPublication> findIncompletePublications()
      Specified by:
      findIncompletePublications in interface org.springframework.modulith.events.core.EventPublicationRepository
    • findIncompletePublicationsPublishedBefore

      @Transactional(readOnly=true) public List<org.springframework.modulith.events.core.TargetEventPublication> findIncompletePublicationsPublishedBefore(Instant instant)
      Specified by:
      findIncompletePublicationsPublishedBefore in interface org.springframework.modulith.events.core.EventPublicationRepository
    • findIncompletePublicationsByEventAndTargetIdentifier

      @Transactional(readOnly=true) public Optional<org.springframework.modulith.events.core.TargetEventPublication> findIncompletePublicationsByEventAndTargetIdentifier(Object event, org.springframework.modulith.events.core.PublicationTargetIdentifier targetIdentifier)
      Specified by:
      findIncompletePublicationsByEventAndTargetIdentifier in interface org.springframework.modulith.events.core.EventPublicationRepository
    • findCompletedPublications

      public List<org.springframework.modulith.events.core.TargetEventPublication> findCompletedPublications()
      Specified by:
      findCompletedPublications in interface org.springframework.modulith.events.core.EventPublicationRepository
    • findFailedPublications

      public List<org.springframework.modulith.events.core.TargetEventPublication> findFailedPublications(org.springframework.modulith.events.core.EventPublicationRepository.FailedCriteria criteria)
      Specified by:
      findFailedPublications in interface org.springframework.modulith.events.core.EventPublicationRepository
    • deletePublications

      public void deletePublications(List<UUID> identifiers)
      Specified by:
      deletePublications in interface org.springframework.modulith.events.core.EventPublicationRepository
    • deleteCompletedPublications

      public void deleteCompletedPublications()
      Specified by:
      deleteCompletedPublications in interface org.springframework.modulith.events.core.EventPublicationRepository
    • deleteCompletedPublicationsBefore

      public void deleteCompletedPublicationsBefore(Instant instant)
      Specified by:
      deleteCompletedPublicationsBefore in interface org.springframework.modulith.events.core.EventPublicationRepository
    • findByStatus

      public List<org.springframework.modulith.events.core.TargetEventPublication> findByStatus(org.springframework.modulith.events.EventPublication.Status status)
      Specified by:
      findByStatus in interface org.springframework.modulith.events.core.EventPublicationRepository
    • countByStatus

      public int countByStatus(org.springframework.modulith.events.EventPublication.Status status)
      Specified by:
      countByStatus in interface org.springframework.modulith.events.core.EventPublicationRepository
    • getCompletedEntityType

      public Class<? extends JpaEventPublication> getCompletedEntityType()
      Returns the type representing completed event publications.
      Returns:
      will never be null.
      Since:
      1.3