Class DefaultEventExternalizationConfiguration
java.lang.Object
org.springframework.modulith.events.DefaultEventExternalizationConfiguration
- All Implemented Interfaces:
EventExternalizationConfiguration
class DefaultEventExternalizationConfiguration
extends Object
implements EventExternalizationConfiguration
Default implementation of
EventExternalizationConfiguration.- Since:
- 1.1
- Author:
- Oliver Drotbohm
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.modulith.events.EventExternalizationConfiguration
EventExternalizationConfiguration.BaseConfiguration<T extends EventExternalizationConfiguration.BaseConfiguration<T>>, EventExternalizationConfiguration.Router, EventExternalizationConfiguration.Selector -
Constructor Summary
ConstructorsConstructorDescriptionDefaultEventExternalizationConfiguration(Predicate<Object> filter, Function<Object, Object> mapper, Function<Object, RoutingTarget> router, Function<Object, Map<String, Object>> headers, boolean serializeExternalization) Creates a newDefaultEventExternalizationConfiguration -
Method Summary
Modifier and TypeMethodDescription(package private) static EventExternalizationConfiguration.Selectorbuilder()Returns a newEventExternalizationConfiguration.Selectorinstance to build up a new configuration.determineTarget(Object event) Determines theRoutingTargetfor the given event based on the current configuration.getHeadersFor(Object event) Returns the headers to be attached to the message sent out for the given event.Map the event to be externalized before publishing it.booleanReturns whether the event externalization should be serialized to make sure the broker sees the events in the order they were published in the application.booleanWhether the configuration supports the given event.
-
Constructor Details
-
DefaultEventExternalizationConfiguration
DefaultEventExternalizationConfiguration(Predicate<Object> filter, Function<Object, Object> mapper, Function<Object, RoutingTarget> router, Function<Object, Map<String, Object>> headers, boolean serializeExternalization) Creates a newDefaultEventExternalizationConfiguration- Parameters:
filter- must not be null.mapper- must not be null.router- must not be null.headers- must not be null.
-
-
Method Details
-
builder
Returns a newEventExternalizationConfiguration.Selectorinstance to build up a new configuration.- Returns:
- will never be null.
-
supports
Description copied from interface:EventExternalizationConfigurationWhether the configuration supports the given event. In other words, whether the given event is supposed to be externalized in the first place.- Specified by:
supportsin interfaceEventExternalizationConfiguration- Parameters:
event- must not be null.- Returns:
- whether to externalize the given event.
-
map
Description copied from interface:EventExternalizationConfigurationMap the event to be externalized before publishing it.- Specified by:
mapin interfaceEventExternalizationConfiguration- Parameters:
event- must not be null.- Returns:
- the mapped event.
-
determineTarget
Description copied from interface:EventExternalizationConfigurationDetermines theRoutingTargetfor the given event based on the current configuration.- Specified by:
determineTargetin interfaceEventExternalizationConfiguration- Parameters:
event- must not be null.- Returns:
- will never be null.
-
getHeadersFor
Description copied from interface:EventExternalizationConfigurationReturns the headers to be attached to the message sent out for the given event.- Specified by:
getHeadersForin interfaceEventExternalizationConfiguration- Parameters:
event- must not be null.- Returns:
- will never be null.
-
serializeExternalization
public boolean serializeExternalization()Description copied from interface:EventExternalizationConfigurationReturns whether the event externalization should be serialized to make sure the broker sees the events in the order they were published in the application. By default, this is not guaranteed as multiple threads might trigger events and the externalization of one event might overtake the one of another.- Specified by:
serializeExternalizationin interfaceEventExternalizationConfiguration
-