public class AcceptAllCommandsDiscoveryMode extends AbstractCapabilityDiscoveryMode<AcceptAllCommandsDiscoveryMode>
CapabilityDiscoveryMode which defaults its own MemberCapabilities to accept
all incoming commands. It does so by enforcing the CommandMessageFilter to AcceptAll on each
invocation of updateLocalCapabilities(ServiceInstance, int, CommandMessageFilter). This implementation thus
does not take into account the given CommandMessageFilter upon any updateLocalCapabilities(ServiceInstance, int, CommandMessageFilter) invocation.
Using this implementation would be a valid solution in a homogeneous command handling system, where every node can handling everything.
Note that both the updateLocalCapabilities(ServiceInstance, int, CommandMessageFilter) and capabilities(ServiceInstance) operations are delegated towards another CapabilityDiscoveryMode instance to
ensure MemberCapabilities can still be found and delegated as is required of a CapabilityDiscoveryMode implementation.
| Modifier and Type | Class and Description |
|---|---|
static class |
AcceptAllCommandsDiscoveryMode.Builder
Builder class to instantiate a
AcceptAllCommandsDiscoveryMode. |
localCapabilities, localInstance| Modifier | Constructor and Description |
|---|---|
protected |
AcceptAllCommandsDiscoveryMode(AcceptAllCommandsDiscoveryMode.Builder builder)
Instantiate a
AcceptAllCommandsDiscoveryMode based on the fields contained in the AcceptAllCommandsDiscoveryMode.Builder. |
| Modifier and Type | Method and Description |
|---|---|
static AcceptAllCommandsDiscoveryMode.Builder |
builder()
Instantiate a
AcceptAllCommandsDiscoveryMode.Builder to be able to create a AcceptAllCommandsDiscoveryMode. |
Optional<MemberCapabilities> |
capabilities(org.springframework.cloud.client.ServiceInstance serviceInstance)
|
void |
updateLocalCapabilities(org.springframework.cloud.client.ServiceInstance localInstance,
int loadFactor,
org.axonframework.commandhandling.distributed.CommandMessageFilter commandFilter)
Update the capabilities of the
localInstance, defined through the given loadFactor and commandFilter. |
protected AcceptAllCommandsDiscoveryMode(AcceptAllCommandsDiscoveryMode.Builder builder)
AcceptAllCommandsDiscoveryMode based on the fields contained in the AcceptAllCommandsDiscoveryMode.Builder.
Will assert that the delegate CapabilityDiscoveryMode is not null and will throw an AxonConfigurationException if this is the case.
builder - the AcceptAllCommandsDiscoveryMode.Builder used to instantiate a AcceptAllCommandsDiscoveryMode instancepublic static AcceptAllCommandsDiscoveryMode.Builder builder()
AcceptAllCommandsDiscoveryMode.Builder to be able to create a AcceptAllCommandsDiscoveryMode.
The delegate CapabilityDiscoveryMode is a hard requirement and as such should be provided.
AcceptAllCommandsDiscoveryMode.Builder to be able to create a AcceptAllCommandsDiscoveryModepublic void updateLocalCapabilities(org.springframework.cloud.client.ServiceInstance localInstance,
int loadFactor,
org.axonframework.commandhandling.distributed.CommandMessageFilter commandFilter)
CapabilityDiscoveryModelocalInstance, defined through the given loadFactor and commandFilter.updateLocalCapabilities in interface CapabilityDiscoveryModeupdateLocalCapabilities in class AbstractCapabilityDiscoveryMode<AcceptAllCommandsDiscoveryMode>localInstance - the local ServiceInstanceloadFactor - the load factor of the local instance, defining the amount of load this instance can carrycommandFilter - a filter defining the CommandMessages the local
instance is capable of handlingpublic Optional<MemberCapabilities> capabilities(org.springframework.cloud.client.ServiceInstance serviceInstance) throws ServiceInstanceClientException
CapabilityDiscoveryModeserviceInstance - the ServiceInstance to discover MemberCapabilities forOptional MemberCapabilities, based on the given serviceInstanceServiceInstanceClientException - whenever the ServiceInstance returns a client specific exceptionCopyright © 2010–2023. All rights reserved.