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
ConstructorsConstructorDescriptionDelegatingEventExternalizer(EventExternalizationConfiguration configuration, BiFunction<RoutingTarget, Object, CompletableFuture<?>> delegate) Creates a newDelegatingEventExternalizerfor the givenEventExternalizationConfigurationandBiFunctionimplementing 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 newDelegatingEventExternalizerfor the givenEventExternalizationConfigurationandBiFunctionimplementing the actual externalization.- Parameters:
configuration- must not be null.delegate- must not be null.
-
-
Method Details
-
externalize
@ApplicationModuleListener(propagation=SUPPORTS) public CompletableFuture<?> externalize(Object event) Description copied from class:EventExternalizationSupportExternalizes the given event.- Overrides:
externalizein classEventExternalizationSupport- Parameters:
event- must not be null.- Returns:
- the externalization result, will never be null.
-
externalize
Description copied from class:EventExternalizationSupportPublish the given payload to the givenRoutingTarget.- Specified by:
externalizein classEventExternalizationSupport- Parameters:
payload- must not be null.target- must not be null.- Returns:
- the externalization result, will never be null.
-