You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/antora/modules/ROOT/pages/events.adoc
+37Lines changed: 37 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -195,6 +195,41 @@ class InventoryManagement {
195
195
----
196
196
======
197
197
198
+
[CAUTION]
199
+
====
200
+
Spring Modulith writes events published without an ongoing transaction to the event publication log, but Spring Framework does not deliver them immediately. They will only be delivered when incomplete event publications are retried (see <<publication-registry>>). To receive the events immediately, annotate the event handler with `@TransactionalEventListener(fallbackExecution = true)`:
Please see Spring Framework's documentation on https://docs.spring.io/spring-framework/reference/data-access/transaction/event.html#page-title[Transaction-bound Events] for further information.
231
+
====
232
+
198
233
[[publication-registry]]
199
234
== The Event Publication Registry
200
235
@@ -204,6 +239,8 @@ On event publication, it finds out about the transactional event listeners that
204
239
.The transactional event listener arrangement before execution
205
240
image::event-publication-registry-start.png[]
206
241
242
+
IMPORTANT: While Spring Framework continues to deliver events to handlers annotated with `@EventListener` alone, the event publication registry ignores them and does not write them to the event publication log. The event publication registry only considers methods annotated with `@TransactionalEventListener` or one of its subclasses, like `@ApplicationModuleListener`.
243
+
207
244
Each transactional event listener is wrapped into an aspect that marks that log entry as completed if the execution of the listener succeeds.
208
245
In case the listener fails, the log entry stays untouched so that retry mechanisms can be deployed depending on the application's needs.
209
246
Automatic re-publication of the events can be enabled via the xref:appendix.adoc#configuration-properties[`spring.modulith.events.republish-outstanding-events-on-restart`] property.
0 commit comments