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.Router, EventExternalizationConfiguration.Selector
-
Constructor Summary
ConstructorDescriptionDefaultEventExternalizationConfiguration
(Predicate<Object> filter, Function<Object, Object> mapper, Function<Object, RoutingTarget> router, Function<Object, Map<String, Object>> headers) Creates a newDefaultEventExternalizationConfiguration
-
Method Summary
Modifier and TypeMethodDescription(package private) static EventExternalizationConfiguration.Selector
builder()
Returns a newEventExternalizationConfiguration.Selector
instance to build up a new configuration.determineTarget
(Object event) Determines theRoutingTarget
for 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.boolean
Whether 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) 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.Selector
instance to build up a new configuration.- Returns:
- will never be null.
-
supports
Description copied from interface:EventExternalizationConfiguration
Whether the configuration supports the given event. In other words, whether the given event is supposed to be externalized in the first place.- Specified by:
supports
in interfaceEventExternalizationConfiguration
- Parameters:
event
- must not be null.- Returns:
- whether to externalize the given event.
-
map
Description copied from interface:EventExternalizationConfiguration
Map the event to be externalized before publishing it.- Specified by:
map
in interfaceEventExternalizationConfiguration
- Parameters:
event
- must not be null.- Returns:
- the mapped event.
-
determineTarget
Description copied from interface:EventExternalizationConfiguration
Determines theRoutingTarget
for the given event based on the current configuration.- Specified by:
determineTarget
in interfaceEventExternalizationConfiguration
- Parameters:
event
- must not be null.- Returns:
- will never be null.
-
getHeadersFor
Description copied from interface:EventExternalizationConfiguration
Returns the headers to be attached to the message sent out for the given event.- Specified by:
getHeadersFor
in interfaceEventExternalizationConfiguration
- Parameters:
event
- must not be null.- Returns:
- will never be null.
-