Class AnnotationRoutingStrategy.Builder
java.lang.Object
org.axonframework.commandhandling.distributed.AnnotationRoutingStrategy.Builder
- Enclosing class:
AnnotationRoutingStrategy
Builder class to instantiate a
AnnotationRoutingStrategy.
The annotationType is defaulted to RoutingKey and the fallbackRoutingStrategy to UnresolvedRoutingKeyPolicy.RANDOM_KEY.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionannotationType(Class<? extends Annotation> annotationType) Sets theannotationTypeClasssearched for by this routing strategy on aCommandMessageto base the routing key on.build()Initializes aAnnotationRoutingStrategyimplementation as specified through this Builder.fallbackRoutingStrategy(RoutingStrategy fallbackRoutingStrategy) Sets the fallbackRoutingStrategyto use when the intended routing key resolution was unsuccessful.protected voidvalidate()Validate whether the fields contained in this Builder as set accordingly.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
fallbackRoutingStrategy
public AnnotationRoutingStrategy.Builder fallbackRoutingStrategy(RoutingStrategy fallbackRoutingStrategy) Sets the fallbackRoutingStrategyto use when the intended routing key resolution was unsuccessful. Defaults to aUnresolvedRoutingKeyPolicy.RANDOM_KEY- Parameters:
fallbackRoutingStrategy- aRoutingStrategyused as the fallback whenever the intended routing key resolution was unsuccessful- Returns:
- the current Builder instance, for fluent interfacing
-
annotationType
Sets theannotationTypeClasssearched for by this routing strategy on aCommandMessageto base the routing key on. Defaults to theRoutingKeyannotation.- Parameters:
annotationType- an annotationClassto search for on aCommandMessagewhich contains the command's routing key- Returns:
- the current Builder instance, for fluent interfacing
-
build
Initializes aAnnotationRoutingStrategyimplementation as specified through this Builder.- Returns:
- a
AnnotationRoutingStrategyimplementation as specified through this Builder
-
validate
protected void validate()Validate whether the fields contained in this Builder as set accordingly.- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-