Thirteen captured transcripts: a listener is a blocking method call, ordering and chaining, SpEL conditions, generic-event erasure, every transaction phase on commit and rollback, what an AFTER_COMMIT listener can write, which exceptions reach the publisher, async listeners on platform and virtual threads, and the annotations behind Spring Modulith's @ApplicationModuleListener. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Uu7q8vPeREyT4218EJPzz1
17 lines
791 B
Plaintext
17 lines
791 B
Plaintext
# An AFTER_COMMIT listener that inserts a row: three ways to declare it
|
|
|
|
|
|
--- no transaction attribute on the listener ---
|
|
inside the listener, right after the insert: audit row visible to other connections: false
|
|
after place() returned, order rows: 1
|
|
after place() returned, audit rows: 1
|
|
|
|
--- @Transactional(propagation = REQUIRES_NEW) on the listener ---
|
|
order rows: 1
|
|
audit rows: 1
|
|
|
|
--- @Transactional (REQUIRED, the default) on the listener ---
|
|
context started: false
|
|
failure chain: BeanInitializationException -> IllegalStateException
|
|
root cause: @TransactionalEventListener method must not be annotated with @Transactional unless when declared as REQUIRES_NEW or NOT_SUPPORTED: void com.ankurm.events.txwrite.required.AuditRequired.audit(com.ankurm.events.txwrite.shared.OrderPlaced)
|