Example usage for org.springframework.integration.zookeeper.config LeaderInitiatorFactoryBean setRole

List of usage examples for org.springframework.integration.zookeeper.config LeaderInitiatorFactoryBean setRole

Introduction

In this page you can find the example usage for org.springframework.integration.zookeeper.config LeaderInitiatorFactoryBean setRole.

Prototype

public LeaderInitiatorFactoryBean setRole(String role) 

Source Link

Usage

From source file:com.netflix.genie.web.configs.LeadershipConfig.java

/**
 * 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.
 *
 * @param client              The curator framework client to use
 * @param zookeeperProperties The Zookeeper properties to use
 * @return The factory bean//  w w w  .ja va2 s  .  c om
 */
@Bean
@ConditionalOnProperty("genie.zookeeper.enabled")
public LeaderInitiatorFactoryBean leaderInitiatorFactory(final CuratorFramework client,
        final ZookeeperProperties zookeeperProperties) {
    final LeaderInitiatorFactoryBean factoryBean = new LeaderInitiatorFactoryBean();
    factoryBean.setClient(client);
    factoryBean.setPath(zookeeperProperties.getLeader().getPath());
    factoryBean.setRole("cluster");
    return factoryBean;
}