@Configuration
public class SelectorsAutoConfiguration
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
SCRIPT_CLUSTER_SELECTOR_PRECEDENCE
The relative order of the
ScriptClusterSelectorImpl if one is enabled relative to other
ClusterSelector instances that may be in the context. |
Constructor and Description |
---|
SelectorsAutoConfiguration() |
Modifier and Type | Method and Description |
---|---|
CommandSelector |
commandSelector(java.util.Optional<CommandSelectorManagedScript> commandSelectorManagedScriptOptional,
io.micrometer.core.instrument.MeterRegistry registry)
Provide a default
CommandSelector implementation if no other has been defined in the context already. |
RandomClusterSelectorImpl |
randomizedClusterSelector()
The default cluster selector if all others fail.
|
ScriptClusterSelectorImpl |
scriptClusterSelector(ClusterSelectorManagedScript clusterSelectorManagedScript,
io.micrometer.core.instrument.MeterRegistry registry)
Produce the
ScriptClusterSelectorImpl instance to use for this Genie node if it was configured by the
user. |
public static final int SCRIPT_CLUSTER_SELECTOR_PRECEDENCE
ScriptClusterSelectorImpl
if one is enabled relative to other
ClusterSelector
instances that may be in the context. This allows users to fit 50 more
selectors between the script selector and the default RandomClusterSelectorImpl
. If
the user wants to place a selector implementation before the script one they only need to subtract from this
value.@Bean @Order(value=2147483597) @ConditionalOnBean(value=ClusterSelectorManagedScript.class) public ScriptClusterSelectorImpl scriptClusterSelector(ClusterSelectorManagedScript clusterSelectorManagedScript, io.micrometer.core.instrument.MeterRegistry registry)
ScriptClusterSelectorImpl
instance to use for this Genie node if it was configured by the
user. This bean is only created if the script is configured.clusterSelectorManagedScript
- the cluster selector scriptregistry
- the metrics registryScriptClusterSelectorImpl
@Bean @Order public RandomClusterSelectorImpl randomizedClusterSelector()
Defaults to Ordered.LOWEST_PRECEDENCE
.
RandomClusterSelectorImpl
instance@Bean @ConditionalOnMissingBean(value=CommandSelector.class) public CommandSelector commandSelector(java.util.Optional<CommandSelectorManagedScript> commandSelectorManagedScriptOptional, io.micrometer.core.instrument.MeterRegistry registry)
CommandSelector
implementation if no other has been defined in the context already.commandSelectorManagedScriptOptional
- An Optional
wrapping a CommandSelectorManagedScript
instance if one is present in the context else
Optional.empty()
registry
- The MeterRegistry
instance to useScriptCommandSelectorImpl
if a CommandSelectorManagedScript
instance as present else
a RandomCommandSelectorImpl
instance