From c104b36aa03ed3f57fc648cec9277cb82eb43a43 Mon Sep 17 00:00:00 2001 From: "tomasz.patrzalek" Date: Wed, 22 May 2024 08:26:15 +0200 Subject: [PATCH] GH-581 | add possibility to use IncompleteEventPublications.findAll method --- .../modulith/events/IncompleteEventPublications.java | 8 ++++++++ .../support/PersistentApplicationEventMulticaster.java | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/spring-modulith-events/spring-modulith-events-api/src/main/java/org/springframework/modulith/events/IncompleteEventPublications.java b/spring-modulith-events/spring-modulith-events-api/src/main/java/org/springframework/modulith/events/IncompleteEventPublications.java index eda6575d2..cabb9e89d 100644 --- a/spring-modulith-events/spring-modulith-events-api/src/main/java/org/springframework/modulith/events/IncompleteEventPublications.java +++ b/spring-modulith-events/spring-modulith-events-api/src/main/java/org/springframework/modulith/events/IncompleteEventPublications.java @@ -16,6 +16,7 @@ package org.springframework.modulith.events; import java.time.Duration; +import java.util.Collection; import java.util.function.Predicate; /** @@ -26,6 +27,13 @@ */ public interface IncompleteEventPublications { + /** + * Returns all {@link EventPublication}s that have not been completed. + * + * @return will never be {@literal null}. + */ + Collection findAll(); + /** * Triggers the re-submission of events for which incomplete {@link EventPublication}s are registered. Note, that this * will materialize all incomplete event publications. diff --git a/spring-modulith-events/spring-modulith-events-core/src/main/java/org/springframework/modulith/events/support/PersistentApplicationEventMulticaster.java b/spring-modulith-events/spring-modulith-events-core/src/main/java/org/springframework/modulith/events/support/PersistentApplicationEventMulticaster.java index 5b1c5eaf4..b51a541e1 100644 --- a/spring-modulith-events/spring-modulith-events-core/src/main/java/org/springframework/modulith/events/support/PersistentApplicationEventMulticaster.java +++ b/spring-modulith-events/spring-modulith-events-core/src/main/java/org/springframework/modulith/events/support/PersistentApplicationEventMulticaster.java @@ -144,6 +144,11 @@ protected Collection> getApplicationListeners(Application .toList(); } + @Override + public Collection findAll() { + return registry.get().findIncompletePublications(); + } + /* * (non-Javadoc) * @see org.springframework.modulith.events.IncompleteEventPublications#resubmitIncompletePublications(java.util.function.Predicate)