@Configuration
public class LeadershipConfig
extends java.lang.Object
Constructor and Description |
---|
LeadershipConfig() |
Modifier and Type | Method and Description |
---|---|
org.springframework.integration.zookeeper.config.LeaderInitiatorFactoryBean |
leaderInitiatorFactory(org.apache.curator.framework.CuratorFramework client,
ZookeeperProperties zookeeperProperties)
The leadership initialization factory bean which will create a LeaderInitiator to kick off the leader election
process within this node for the cluster if Zookeeper is configured.
|
LeadershipTasksCoordinator |
leadershipTasksCoordinator(org.springframework.scheduling.TaskScheduler taskScheduler,
java.util.Collection<LeadershipTask> tasks)
Create the LeadershipTasksCoordination bean used to start and stop all leadership related tasks based on
whether leadership is granted or revoked.
|
LocalLeader |
localLeader(org.springframework.context.ApplicationEventPublisher publisher,
boolean isLeader)
If Spring Cloud Leadership is disabled and this node is forced to be the leader create the local leader
bean which will fire appropriate events.
|
@Bean @ConditionalOnBean(value=LeadershipTask.class) public LeadershipTasksCoordinator leadershipTasksCoordinator(org.springframework.scheduling.TaskScheduler taskScheduler, java.util.Collection<LeadershipTask> tasks)
taskScheduler
- The task scheduler to use for scheduling leadership taskstasks
- The leadership tasks to schedule@Bean @ConditionalOnProperty(value="genie.zookeeper.enabled") public org.springframework.integration.zookeeper.config.LeaderInitiatorFactoryBean leaderInitiatorFactory(org.apache.curator.framework.CuratorFramework client, ZookeeperProperties zookeeperProperties)
client
- The curator framework client to usezookeeperProperties
- The Zookeeper properties to use@Bean @ConditionalOnProperty(value="genie.zookeeper.enabled", havingValue="false", matchIfMissing=true) public LocalLeader localLeader(org.springframework.context.ApplicationEventPublisher publisher, @Value(value="${genie.leader.enabled}") boolean isLeader)
publisher
- The application event publisher to useisLeader
- Whether this node is the leader of the cluster or not