Class EventExternalizationConfiguration.Selector
java.lang.Object
org.springframework.modulith.events.EventExternalizationConfiguration.Selector
- Enclosing interface:
- EventExternalizationConfiguration
API to define which events are supposed to be selected for externalization.
- Since:
- 1.1
- Author:
- Oliver Drotbohm
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSelects events to externalize by applying the givenPredicate.selectAndRoute(Class<T> annotationType, BiFunction<Object, T, RoutingTarget> router) Selects events by the presence of an annotation of the given type and routes based on the given routerBiFunctionthat also gets the event type to build up a completeRoutingTarget.selectAndRoute(Class<T> annotationType, Function<T, String> router) Selects events by the presence of an annotation of the given type and routes based on the given routerFunction.selectByAnnotation(Class<? extends Annotation> type) Selects events to be externalized by inspecting the event type for the given annotation.selectByPackage(Class<?> type) Selects events to externalize by the package of the given type and all sub-packages.selectByPackage(String basePackage) Selects events to externalize by the given base package and all sub-packages.selectByPackagesAndFilter(Collection<String> basePackages, Predicate<Object> filter) Selects events to externalize by the given base packages (and their sub-packages) that match the given filterPredicate.selectByType(Class<?> type) Selects events to be externalized by type.selectByType(Predicate<Class<?>> predicate) Selects events to be externalized by the givenPredicate.
-
Constructor Details
-
Selector
Selector()Creates a newEventExternalizationConfiguration.Selector.
-
-
Method Details
-
select
Selects events to externalize by applying the givenPredicate.- Parameters:
predicate- will never be null.- Returns:
- will never be null.
-
selectByPackage
Selects events to externalize by the given base package and all sub-packages.- Parameters:
basePackage- must not be null or empty.- Returns:
- will never be null.
-
selectByPackage
Selects events to externalize by the package of the given type and all sub-packages.- Parameters:
type- must not be null.- Returns:
- will never be null.
-
selectByPackagesAndFilter
public EventExternalizationConfiguration.Router selectByPackagesAndFilter(Collection<String> basePackages, Predicate<Object> filter) Selects events to externalize by the given base packages (and their sub-packages) that match the given filterPredicate.- Parameters:
basePackages- must not be null or empty.filter- must not be null.- Returns:
- will never be null.
-
selectByAnnotation
public EventExternalizationConfiguration.Router selectByAnnotation(Class<? extends Annotation> type) Selects events to be externalized by inspecting the event type for the given annotation.- Parameters:
type- the annotation type to find on the event type, must not be null.- Returns:
- will never be null.
-
selectByType
Selects events to be externalized by type.- Parameters:
type- the type that events to be externalized need to implement, must not be null.- Returns:
- will never be null.
-
selectByType
Selects events to be externalized by the givenPredicate.- Parameters:
predicate- must not be null.- Returns:
- will never be null.
-
selectAndRoute
public <T extends Annotation> EventExternalizationConfiguration.Router selectAndRoute(Class<T> annotationType, Function<T, String> router) Selects events by the presence of an annotation of the given type and routes based on the given routerFunction.- Type Parameters:
T- the annotation type.- Parameters:
annotationType- the annotation type, must not be null.router- must not be null.- Returns:
- will never be null.
-
selectAndRoute
public <T extends Annotation> EventExternalizationConfiguration.Router selectAndRoute(Class<T> annotationType, BiFunction<Object, T, RoutingTarget> router) Selects events by the presence of an annotation of the given type and routes based on the given routerBiFunctionthat also gets the event type to build up a completeRoutingTarget.- Type Parameters:
T- the annotation type.- Parameters:
annotationType- must not be null.router- must not be null.- Returns:
- will never be null.
-