Class DelegatingEventExternalizer
java.lang.Object
org.springframework.modulith.events.support.EventExternalizationSupport
org.springframework.modulith.events.support.DelegatingEventExternalizer
- All Implemented Interfaces:
ConditionalEventListener
An
EventExternalizationSupport
delegating to a BiFunction
for the actual externalization. Note, that
this needs to be a Component
to make sure it is considered an event listener, as without the
annotation Spring Framework would skip it as it lives in the org.springframework
package.- Since:
- 1.1
- Author:
- Oliver Drotbohm
-
Constructor Summary
ConstructorDescriptionDelegatingEventExternalizer
(EventExternalizationConfiguration configuration, BiFunction<RoutingTarget, Object, CompletableFuture<?>> delegate) Creates a newDelegatingEventExternalizer
for the givenEventExternalizationConfiguration
andBiFunction
implementing the actual externalization. -
Method Summary
Modifier and TypeMethodDescriptionexternalize
(Object event) Externalizes the given event.protected CompletableFuture<?>
externalize
(Object payload, RoutingTarget target) Publish the given payload to the givenRoutingTarget
.Methods inherited from class org.springframework.modulith.events.support.EventExternalizationSupport
supports
-
Constructor Details
-
DelegatingEventExternalizer
public DelegatingEventExternalizer(EventExternalizationConfiguration configuration, BiFunction<RoutingTarget, Object, CompletableFuture<?>> delegate) Creates a newDelegatingEventExternalizer
for the givenEventExternalizationConfiguration
andBiFunction
implementing the actual externalization.- Parameters:
configuration
- must not be null.delegate
- must not be null.
-
-
Method Details
-
externalize
Description copied from class:EventExternalizationSupport
Externalizes the given event.- Overrides:
externalize
in classEventExternalizationSupport
- Parameters:
event
- must not be null.- Returns:
- the externalization result, will never be null.
-
externalize
Description copied from class:EventExternalizationSupport
Publish the given payload to the givenRoutingTarget
.- Specified by:
externalize
in classEventExternalizationSupport
- Parameters:
payload
- must not be null.target
- must not be null.- Returns:
- the externalization result, will never be null.
-