spring-projects / spring-projects/spring-modulith
spring-modulith: spring.modulith.republish-outstanding-events-on-restart=true unable
Open
@odrotbohm is already working on this.
Since Mar 17, 2024.
in: event publication registry
meta: waiting for feedback
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 222
- PR merge metrics
- No merged PRs in 30d
Description
I set spring.modulith.republish-outstanding-events-on-restart=true, @ApplicationModuleListener sleep 30s, and I restart springboot, but it is unable republish.
- publisher
ApplicationEventPublisher applicationEventPublisher;
...
List<AdminCreateEvent> events=...;
applicationEventPublisher.publishEvent(new ListenerEvent<>(this, events));
- listener
@ApplicationModuleListener
public void listener(ListenerEvent<List<AdminCreateEvent>> event) {
log.debug("listener: {}", event);
Thread.sleep(30_000)
}
- ListenerEvent
import lombok.Getter;
import org.springframework.context.ApplicationEvent;
@Getter
public class ListenerEvent<T> extends ApplicationEvent {
private final transient T data;
public ListenerEvent(Object source, T data) {
super(source);
this.data = data;
}
}
- mysql record:
| ID | LISTENER_ID | EVENT_TYPE | SERIALIZED_EVENT | PUBLICATION_DATE | COMPLETION_DATE |
|---|---|---|---|---|---|
| 6a969ce-5aa8-43ce-bcce-5da833fbe981 | com.admin.event.AdminEventListener.listener(com.admin.event.ListenerEvent) | com.admin.event.ListenerEvent | {"timestamp":1710505254886,"data":[{"eventId":"c883e482-013a-4237-bdec-d6c1f0d7f403"}],"source":{}} | 2024-03-15 20:20:54.887171 |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.