GH-125 - More detailed logging of pending event publication lookup on startup.
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.modulith.events;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -68,7 +69,7 @@ public class DefaultEventPublicationRegistry implements DisposableBean, EventPub
|
||||
* @see org.springframework.modulith.events.EventPublicationRegistry#findIncompletePublications()
|
||||
*/
|
||||
@Override
|
||||
public Iterable<EventPublication> findIncompletePublications() {
|
||||
public Collection<EventPublication> findIncompletePublications() {
|
||||
return events.findIncompletePublications();
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.modulith.events;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.springframework.context.ApplicationListener;
|
||||
@@ -42,7 +43,7 @@ public interface EventPublicationRegistry {
|
||||
*
|
||||
* @return will never be {@literal null}.
|
||||
*/
|
||||
Iterable<EventPublication> findIncompletePublications();
|
||||
Collection<EventPublication> findIncompletePublications();
|
||||
|
||||
/**
|
||||
* Marks the publication for the given event and {@link PublicationTargetIdentifier} as completed.
|
||||
|
||||
@@ -113,9 +113,13 @@ public class PersistentApplicationEventMulticaster extends AbstractApplicationEv
|
||||
@Override
|
||||
public void afterSingletonsInstantiated() {
|
||||
|
||||
for (EventPublication publication : registry.get().findIncompletePublications()) {
|
||||
invokeTargetListener(publication);
|
||||
}
|
||||
LOGGER.debug("Looking up previously pending event publications…");
|
||||
|
||||
var publications = registry.get().findIncompletePublications();
|
||||
|
||||
LOGGER.debug("{} found.", publications.isEmpty() ? "None" : publications.size());
|
||||
|
||||
publications.forEach(this::invokeTargetListener);
|
||||
}
|
||||
|
||||
private void invokeTargetListener(EventPublication publication) {
|
||||
|
||||
Reference in New Issue
Block a user