Annotation Interface ApplicationModuleListener
@Async
@Transactional(propagation=REQUIRES_NEW)
@TransactionalEventListener
@Documented
@Target({METHOD,ANNOTATION_TYPE})
@Retention(RUNTIME)
public @interface ApplicationModuleListener
An
ApplicationModuleListener
is an Async
Spring TransactionalEventListener
that runs in a
transaction itself. Thus, the annotation serves as syntactic sugar for the generally recommend setup to integrate
application modules via events. The setup makes sure that an original business transaction completes successfully and
the integration asynchronously runs in a transaction itself to decouple the integration as much as possible from the
original unit of work.
It is advisable that you use these integration listeners in combination with the Spring Modulith Event Publication Registry to make sure that the event publication does not get lost in case of an application or listener failure.
- Author:
- Oliver Drotbohm
- See Also:
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionboolean
Whether the transaction to be run for the event listener is supposed to be read-only (default false).
-
Element Details
-
readOnlyTransaction
@AliasFor(annotation=org.springframework.transaction.annotation.Transactional.class, attribute="readOnly") boolean readOnlyTransactionWhether the transaction to be run for the event listener is supposed to be read-only (default false).- Default:
- false
-