Skip to content

Commit 74dda2c

Browse files
benjaminknauerodrotbohm
authored andcommitted
GH-368 - Consider filter handed into IncompleteEventPublications.resubmitIncompletePublications(…).
Original pull request: GH-367.
1 parent a518707 commit 74dda2c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

spring-modulith-events/spring-modulith-events-core/src/main/java/org/springframework/modulith/events/support/PersistentApplicationEventMulticaster.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ protected Collection<ApplicationListener<?>> getApplicationListeners(Application
150150
*/
151151
@Override
152152
public void resubmitIncompletePublications(Predicate<EventPublication> filter) {
153-
doResubmitUncompletedPublicationsOlderThan(null);
153+
doResubmitUncompletedPublicationsOlderThan(null, filter);
154154
}
155155

156156
/*
@@ -159,7 +159,7 @@ public void resubmitIncompletePublications(Predicate<EventPublication> filter) {
159159
*/
160160
@Override
161161
public void resubmitIncompletePublicationsOlderThan(Duration duration) {
162-
doResubmitUncompletedPublicationsOlderThan(duration);
162+
doResubmitUncompletedPublicationsOlderThan(duration, __ -> true);
163163
}
164164

165165
/*
@@ -192,7 +192,7 @@ private void invokeTargetListener(TargetEventPublication publication) {
192192
});
193193
}
194194

195-
private void doResubmitUncompletedPublicationsOlderThan(@Nullable Duration duration) {
195+
private void doResubmitUncompletedPublicationsOlderThan(@Nullable Duration duration, Predicate<EventPublication> filter) {
196196

197197
var message = duration != null ? "" : " older than %s".formatted(duration);
198198
var registry = this.registry.get();
@@ -205,7 +205,9 @@ private void doResubmitUncompletedPublicationsOlderThan(@Nullable Duration durat
205205

206206
LOGGER.debug(getConfirmationMessage(publications) + " found.");
207207

208-
publications.forEach(this::invokeTargetListener);
208+
publications.stream() //
209+
.filter(filter) //
210+
.forEach(this::invokeTargetListener);
209211
}
210212

211213
private static ApplicationListener<ApplicationEvent> executeListenerWithCompletion(EventPublication publication,

0 commit comments

Comments
 (0)