GH-1123 - Detect events configured for externalization published outside a transaction#1456
Conversation
8ae599d to
e38c964
Compare
… published outside a transaction. Signed-off-by: yunhobb <a01049048063@gmail.com>
e38c964 to
2cc322a
Compare
| Supplier<Environment> environment) { | ||
| this(registry, environment, EventExternalizationConfiguration::disabled); | ||
| } | ||
|
|
There was a problem hiding this comment.
I added new 3-arg constructor but kept the old 2-arg one to not break existing API. The old one just delegates to new one with disabled config. If you think @deprecated is needed or want different approach, please let me know.
There was a problem hiding this comment.
The only way to verify this detection is checking log output, so I used Logback ListAppender to capture it. I see this pattern is not used in other tests in this project. If you prefer different way to test this, I'm happy to change.
|
Hi @odrotbohm, 😄 I hope you're doing well! I just wanted to kindly follow up on this PR. I recently rebased onto the latest main and left a couple of review comments explaining my design decisions — particularly around the backward-compatible constructor overload and the test approach. I completely understand you have a busy schedule, so there's no rush at all. Whenever you get a chance, I'd really appreciate any feedback — even a quick note on whether the overall direction looks right would be super helpful. Thank you for your time! |
Summary
Events configured for externalization via
@Externalizedsilently fail when published outside a transaction context — they are neither persisted nor externalized. This can be difficult to diagnose.This change adds a warning log in
PersistentApplicationEventMulticasterto detect this scenario and inform developers with actionable guidance.Fixes #1123
Changes
EventExternalizationConfigurationas an optional dependency toPersistentApplicationEventMulticasterwith a backward-compatible two-argument constructor overloaddetectEventPublishedOutsideTransaction()that logs a warning when:ObjectProvider<EventExternalizationConfiguration>throughEventPublicationConfigurationandEventPublicationAutoConfigurationTransactionalEventListeners.hasListeners()Test plan