Class HekateClusterServiceConfigurer
- java.lang.Object
-
- io.hekate.spring.boot.cluster.HekateClusterServiceConfigurer
-
@Configuration @ConditionalOnHekateEnabled @AutoConfigureBefore(HekateConfigurer.class) @ConditionalOnMissingBean(ClusterServiceFactory.class) public class HekateClusterServiceConfigurer extends Object
« start hereAuto-configuration forClusterService
.Overview
This auto-configuration constructs a
Bean
ofClusterServiceFactory
type and auto-wires it with the following beans from the application context:Note: this auto-configuration is available only if application doesn't provide its own
Bean
ofClusterServiceFactory
type.Configuration Properties
It is possible to configure
ClusterServiceFactory
via application properties prefixed with'hekate.cluster'
. For example:'hekate.cluster.namespace'
'hekate.cluster.gossip-interval'
'hekate.cluster.speed-up-gossip-size'
ClusterServiceFactory.setSplitBrainCheckInterval(long)
'hekate.cluster.split-brain-check-interval'}
Additionally, if application doesn't provide its own
Bean
ofFailureDetector
type thenDefaultFailureDetector
will be registered and can be configured via the following properties:'hekate.cluster.health.heartbeat-interval'
'hekate.cluster.health.heartbeat-loss-threshold'
'hekate.cluster.health.failure-detection-quorum'
DefaultFailureDetectorConfig.setFailFast(boolean)
'hekate.cluster.health.fail-fast'}
Seed Node Providers
This auto-configuration registers all beans of the
SeedNodeProvider
type that can be found in the application context. All such providers will be registered as a singleSeedNodeProviderGroup
. Error handling policy of that group can be specified via the'hekate.cluster.seed.policy'
property.For auto-configuration of
SeedNodeProviders
please see the documentation of the following classes:HekateMulticastSeedNodeProviderConfigurer
HekateFsSeedNodeProviderConfigurer
HekateJdbcSeedNodeProviderConfigurer
HekateZooKeeperSeedNodeProviderConfigurer
HekateEtcdSeedNodeProviderConfigurer
HekateConsulSeedNodeProviderConfigurer
HekateCloudStoreSeedNodeProviderConfigurer
HekateCloudSeedNodeProviderConfigurer
HekateStaticSeedNodeProviderConfigurer
- See Also:
ClusterService
,HekateConfigurer
-
-
Constructor Summary
Constructors Constructor Description HekateClusterServiceConfigurer(Optional<List<SeedNodeProvider>> seedNodeProviders, Optional<List<ClusterEventListener>> listeners, Optional<List<ClusterAcceptor>> acceptors, Optional<SplitBrainDetector> splitBrainDetector)
Constructs new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ClusterServiceBean
clusterService()
Returns the factory bean that makes it possible to injectClusterService
directly into other beans instead of accessing it viaHekate.cluster()
method.ClusterServiceFactory
clusterServiceFactory(Optional<FailureDetector> failureDetector)
Constructs theClusterServiceFactory
.DefaultFailureDetector
defaultFailureDetector(DefaultFailureDetectorConfig cfg)
Conditionally constructs the default failure detector if application doesn't provide its ownBean
ofFailureDetector
type.DefaultFailureDetectorConfig
defaultFailureDetectorConfig()
Conditionally constructs the configuration for a default failure detector if application doesn't provide its ownBean
ofFailureDetector
type.SeedNodeProviderGroupConfig
seedNodeProviderGroupConfig()
Constructs a group configuration of allSeedNodeProvider
s that were found in the application context.
-
-
-
Constructor Detail
-
HekateClusterServiceConfigurer
public HekateClusterServiceConfigurer(Optional<List<SeedNodeProvider>> seedNodeProviders, Optional<List<ClusterEventListener>> listeners, Optional<List<ClusterAcceptor>> acceptors, Optional<SplitBrainDetector> splitBrainDetector)
Constructs new instance.- Parameters:
seedNodeProviders
-SeedNodeProvider
s that were found in the application context.listeners
- AllClusterEventListener
s that were found in the application context.acceptors
- AllClusterAcceptor
s that were found in the application context.splitBrainDetector
-SplitBrainDetector
that was found in the application context.
-
-
Method Detail
-
defaultFailureDetectorConfig
@Bean @ConfigurationProperties(prefix="hekate.cluster.health") @ConditionalOnMissingBean({FailureDetector.class,DefaultFailureDetectorConfig.class}) public DefaultFailureDetectorConfig defaultFailureDetectorConfig()
Conditionally constructs the configuration for a default failure detector if application doesn't provide its ownBean
ofFailureDetector
type.- Returns:
- Configuration for
DefaultFailureDetector
.
-
defaultFailureDetector
@Bean @ConditionalOnMissingBean(FailureDetector.class) public DefaultFailureDetector defaultFailureDetector(DefaultFailureDetectorConfig cfg)
Conditionally constructs the default failure detector if application doesn't provide its ownBean
ofFailureDetector
type.- Parameters:
cfg
- Configuration (seedefaultFailureDetectorConfig()
).- Returns:
- Failure detector.
-
seedNodeProviderGroupConfig
@Bean @ConfigurationProperties(prefix="hekate.cluster.seed") public SeedNodeProviderGroupConfig seedNodeProviderGroupConfig()
Constructs a group configuration of allSeedNodeProvider
s that were found in the application context.- Returns:
- Configuration of seed node provider group
-
clusterServiceFactory
@Bean @ConfigurationProperties(prefix="hekate.cluster") public ClusterServiceFactory clusterServiceFactory(Optional<FailureDetector> failureDetector)
Constructs theClusterServiceFactory
.- Parameters:
failureDetector
- Failure detector.- Returns:
- Service factory.
-
clusterService
@Lazy @Bean public ClusterServiceBean clusterService()
Returns the factory bean that makes it possible to injectClusterService
directly into other beans instead of accessing it viaHekate.cluster()
method.- Returns:
- Service bean.
-
-