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

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

Introduction

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

Prototype

public LeaderInitiatorFactoryBean setClient(CuratorFramework client) 

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.j  a  v  a2 s  .  c  o m
 */
@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;
}