public class IgnoreListingDiscoveryMode extends AbstractCapabilityDiscoveryMode<IgnoreListingDiscoveryMode>
CapabilityDiscoveryMode, delegating all operations to another CapabilityDiscoveryMode instance. When discovering capabilities(ServiceInstance), the given ServiceInstance might be added to the ignored instance list.
ServiceInstances are ignored whenever a ServiceInstanceClientException is thrown, upon which the
ServiceInstance is stored for subsequent invocation. On the next capabilities(ServiceInstance)
iteration, the given ServiceInstance is validated to not be present in the set of ignored service
instance identifiers.
Ignored ServiceInstances are evicted from the list after a configurable expireThreshold (through the
IgnoreListingDiscoveryMode.Builder.expireThreshold(Duration)). Eviction occurs during any> capabilities(ServiceInstance) invocation. It will thus run in line with the heartbeat configuration of the chosen
Spring Cloud Discovery implementation.
| Modifier and Type | Class and Description |
|---|---|
static class |
IgnoreListingDiscoveryMode.Builder
Builder class to instantiate a
IgnoreListingDiscoveryMode. |
| Modifier and Type | Field and Description |
|---|---|
static Clock |
clock
Clock instance used to set the expiry time of ignored ServiceInstances. |
localCapabilities, localInstance| Modifier | Constructor and Description |
|---|---|
protected |
IgnoreListingDiscoveryMode(IgnoreListingDiscoveryMode.Builder builder)
Instantiate a
IgnoreListingDiscoveryMode based on the fields contained in the IgnoreListingDiscoveryMode.Builder. |
| Modifier and Type | Method and Description |
|---|---|
static IgnoreListingDiscoveryMode.Builder |
builder()
Instantiate a
IgnoreListingDiscoveryMode.Builder to be able to create a IgnoreListingDiscoveryMode. |
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 IgnoreListingDiscoveryMode(IgnoreListingDiscoveryMode.Builder builder)
IgnoreListingDiscoveryMode based on the fields contained in the IgnoreListingDiscoveryMode.Builder.
Will assert that the delegate CapabilityDiscoveryMode is not null and will throw an AxonConfigurationException if this is the case.
builder - the IgnoreListingDiscoveryMode.Builder used to instantiate a IgnoreListingDiscoveryMode instancepublic static IgnoreListingDiscoveryMode.Builder builder()
IgnoreListingDiscoveryMode.Builder to be able to create a IgnoreListingDiscoveryMode.
The expireThreshold is defaulted to a Duration of 1 minute. The delegate CapabilityDiscoveryMode is a hard requirement and as such should be provided.
IgnoreListingDiscoveryMode.Builder to be able to create a IgnoreListingDiscoveryModepublic 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<IgnoreListingDiscoveryMode>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.