コード例 #1
0
 private String buildZookeeperPath(final String suffix) {
   return "/"
       + config.getZookeeperPrefix()
       + "/"
       + config.getTopologyName()
       + "/"
       + config.getStreamName()
       + "/"
       + suffix;
 }
コード例 #2
0
  /**
   * Create and configure the ZK sync object with the KinesisSpoutConfig.
   *
   * @param config the configuration for the spout.
   */
  ZookeeperShardState(final KinesisSpoutConfig config) {
    this.config = config;
    this.rand = new Random();

    try {
      zk =
          CuratorFrameworkFactory.newClient(
              config.getZookeeperConnectionString(),
              new ExponentialBackoffRetry(BASE_SLEEP_TIME_MS, MAX_NUM_RETRIES));
    } catch (IOException e) {
      LOG.error("Could not connect to ZooKeeper", e);
      throw new KinesisSpoutException(e);
    }
    zk.start();
  }