public static class SpringCloudCommandRouter.Builder extends Object
SpringCloudCommandRouter.
The Serializer is defaulted to a XStreamSerializer, the serviceInstanceFilter to accept
all instances, and the ConsistentHashChangeListener to a no-op solution. The DiscoveryClient,
localServiceInstance of type Registration, the RoutingStrategy and the CapabilityDiscoveryMode are hard requirements and as such should be provided.
| Modifier and Type | Field and Description |
|---|---|
protected Supplier<org.axonframework.serialization.Serializer> |
serializerSupplier |
| Constructor and Description |
|---|
Builder() |
| Modifier and Type | Method and Description |
|---|---|
SpringCloudCommandRouter |
build()
Initializes a
SpringCloudCommandRouter as specified through this Builder. |
SpringCloudCommandRouter.Builder |
capabilityDiscoveryMode(CapabilityDiscoveryMode capabilityDiscoveryMode)
Defines the
CapabilityDiscoveryMode used by this CommandRouter implementation. |
SpringCloudCommandRouter.Builder |
consistentHashChangeListener(org.axonframework.commandhandling.distributed.ConsistentHashChangeListener consistentHashChangeListener)
Sets the
ConsistentHashChangeListener which is notified when a change in membership has
potentially caused a change in the consistent hash. |
SpringCloudCommandRouter.Builder |
contextRootMetadataPropertyName(String contextRootMetadataPropertyName)
Sets a property key to be expected in the
ServiceInstance.getMetadata() returned object, defining the
context root for the given ServiceInstance. |
SpringCloudCommandRouter.Builder |
discoveryClient(org.springframework.cloud.client.discovery.DiscoveryClient discoveryClient)
Sets the
DiscoveryClient used to discovery and notify other nodes. |
SpringCloudCommandRouter.Builder |
localServiceInstance(org.springframework.cloud.client.serviceregistry.Registration localServiceInstance)
Sets the
Registration, representing the local Service Instance of this application. |
SpringCloudCommandRouter.Builder |
routingStrategy(org.axonframework.commandhandling.distributed.RoutingStrategy routingStrategy)
Sets the
RoutingStrategy used to define the key on which Command Messages are routed to their
respective nodes. |
SpringCloudCommandRouter.Builder |
serializer(org.axonframework.serialization.Serializer serializer)
Sets the
Serializer used to de-/serialize the CommandMessageFilter. |
SpringCloudCommandRouter.Builder |
serviceInstanceFilter(Predicate<org.springframework.cloud.client.ServiceInstance> serviceInstanceFilter)
Sets a
Predicate of generic type ServiceInstance, used to filter out ServiceInstances
from the membership update loop. |
protected void |
validate()
Validate whether the fields contained in this Builder as set accordingly.
|
protected Supplier<org.axonframework.serialization.Serializer> serializerSupplier
public SpringCloudCommandRouter.Builder discoveryClient(org.springframework.cloud.client.discovery.DiscoveryClient discoveryClient)
DiscoveryClient used to discovery and notify other nodes. Used to update its own membership
as a CommandRouter and to create its awareness of available nodes to send commands to.discoveryClient - the DiscoveryClient used to discovery and notify other nodespublic SpringCloudCommandRouter.Builder localServiceInstance(org.springframework.cloud.client.serviceregistry.Registration localServiceInstance)
Registration, representing the local Service Instance of this application. Necessary to
differentiate other instances from the local instance to ensure correct message routing.localServiceInstance - the Registration, representing the local Service Instance of this
applicationpublic SpringCloudCommandRouter.Builder routingStrategy(org.axonframework.commandhandling.distributed.RoutingStrategy routingStrategy)
RoutingStrategy used to define the key on which Command Messages are routed to their
respective nodes.routingStrategy - the RoutingStrategy used to define the key on which Command Messages are
routed to their respective nodespublic SpringCloudCommandRouter.Builder capabilityDiscoveryMode(CapabilityDiscoveryMode capabilityDiscoveryMode)
CapabilityDiscoveryMode used by this CommandRouter implementation. The CapabilityDiscoveryMode is in charge of discovering the capabilities of other nodes and sharing this node's
capabilities.capabilityDiscoveryMode - a CapabilityDiscoveryMode in charge of discovering the capabilities of
other nodes and sharing this node's capabilitiespublic SpringCloudCommandRouter.Builder serializer(org.axonframework.serialization.Serializer serializer)
Serializer used to de-/serialize the CommandMessageFilter. It is strongly
recommended to use the XStreamSerializer for this, as the CommandMessageFilter is not set up
to be serialized through Jackson. Defaults to the XStreamSerializer.serializer - a Serializer used to de-/serialize CommandMessageFilterpublic SpringCloudCommandRouter.Builder serviceInstanceFilter(Predicate<org.springframework.cloud.client.ServiceInstance> serviceInstanceFilter)
Predicate of generic type ServiceInstance, used to filter out ServiceInstances
from the membership update loop. Defaults to allow all ServiceInstances.serviceInstanceFilter - the Predicate of generic type ServiceInstance, used to filter
out ServiceInstances from the membership update looppublic SpringCloudCommandRouter.Builder consistentHashChangeListener(org.axonframework.commandhandling.distributed.ConsistentHashChangeListener consistentHashChangeListener)
ConsistentHashChangeListener which is notified when a change in membership has
potentially caused a change in the consistent hash. Defaults to a no-op solution.consistentHashChangeListener - the ConsistentHashChangeListener which is notified when a change
in membership has potentially caused a change in the consistent
hashpublic SpringCloudCommandRouter.Builder contextRootMetadataPropertyName(String contextRootMetadataPropertyName)
ServiceInstance.getMetadata() returned object, defining the
context root for the given ServiceInstance. Will be used to correctly configure the URI of a Member. Will default to null.contextRootMetadataPropertyName - the optional metadata property field of a ServiceInstance that
contains the context root path of the service in questionpublic SpringCloudCommandRouter build()
SpringCloudCommandRouter as specified through this Builder.SpringCloudCommandRouter as specified through this Builderprotected void validate()
org.axonframework.common.AxonConfigurationException - if one field is asserted to be incorrect according to the Builder's
specificationsCopyright © 2010–2023. All rights reserved.