Class NamastackOutboxEventRecorder
java.lang.Object
org.springframework.modulith.events.namastack.NamastackOutboxEventRecorder
- All Implemented Interfaces:
EventListener,ApplicationListener<PayloadApplicationEvent<?>>
class NamastackOutboxEventRecorder
extends Object
implements ApplicationListener<PayloadApplicationEvent<?>>
An
ApplicationListener that listens to all PayloadApplicationEvents and schedules externalized events
to an Outbox for later processing. This listener operates synchronously within the same transaction as the
event publisher, ensuring the outbox record is committed or rolled back together with the business operation.- Since:
- 2.1
- Author:
- Roland Beisel
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionNamastackOutboxEventRecorder(EventExternalizationConfiguration configuration, io.namastack.outbox.Outbox outbox) Creates a newNamastackOutboxEventRecorderfor the givenEventExternalizationConfigurationandOutbox. -
Method Summary
Modifier and TypeMethodDescriptionvoidonApplicationEvent(PayloadApplicationEvent<?> event) Handles incoming application events by checking if they should be externalized and scheduling them to the outbox within the current transaction.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.context.ApplicationListener
supportsAsyncExecution
-
Constructor Details
-
NamastackOutboxEventRecorder
NamastackOutboxEventRecorder(EventExternalizationConfiguration configuration, io.namastack.outbox.Outbox outbox) Creates a newNamastackOutboxEventRecorderfor the givenEventExternalizationConfigurationandOutbox.- Parameters:
configuration- must not be null.outbox- must not be null.
-
-
Method Details
-
onApplicationEvent
Handles incoming application events by checking if they should be externalized and scheduling them to the outbox within the current transaction.- Specified by:
onApplicationEventin interfaceApplicationListener<PayloadApplicationEvent<?>>- Parameters:
event- the payload application event to process
-