pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths.consumersRuntimePath()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths.consumersRuntimePath()方法的一些代码示例,展示了ZookeeperPaths.consumersRuntimePath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperPaths.consumersRuntimePath()方法的具体详情如下:
包路径:pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths
类名称:ZookeeperPaths
方法名:consumersRuntimePath

ZookeeperPaths.consumersRuntimePath介绍

暂无

代码示例

代码示例来源:origin: allegro/hermes

private String assignmentPath(String subscription, String supervisorId) {
  return paths.consumersRuntimePath(CLUSTER_NAME) + "/" + subscription + "/" + supervisorId;
}

代码示例来源:origin: allegro/hermes

@Override
public SubscriptionAssignmentRegistry provide() {
  ZookeeperPaths paths = new ZookeeperPaths(configFactory.getStringProperty(Configs.ZOOKEEPER_ROOT));
  String cluster = configFactory.getStringProperty(KAFKA_CLUSTER_NAME);
  String consumersRuntimePath = paths.consumersRuntimePath(cluster);
  return new SubscriptionAssignmentRegistry(
      curatorClient,
      subscriptionAssignmentCache,
      new SubscriptionAssignmentPathSerializer(consumersRuntimePath, AUTO_ASSIGNED_MARKER)
  );
}

代码示例来源:origin: pl.allegro.tech.hermes/hermes-consumers

@Override
public SubscriptionAssignmentRegistry provide() {
  ZookeeperPaths paths = new ZookeeperPaths(configFactory.getStringProperty(Configs.ZOOKEEPER_ROOT));
  String cluster = configFactory.getStringProperty(KAFKA_CLUSTER_NAME);
  String consumersRuntimePath = paths.consumersRuntimePath(cluster);
  return new SubscriptionAssignmentRegistry(
      curatorClient,
      subscriptionAssignmentCache,
      new SubscriptionAssignmentPathSerializer(consumersRuntimePath, AUTO_ASSIGNED_MARKER)
  );
}

代码示例来源:origin: allegro/hermes

@Inject
public SubscriptionAssignmentCache(CuratorFramework curator,
                  ConfigFactory configFactory,
                  ZookeeperPaths zookeeperPaths,
                  SubscriptionsCache subscriptionsCache) {
  this.curator = curator;
  this.basePath = zookeeperPaths.consumersRuntimePath(configFactory.getStringProperty(KAFKA_CLUSTER_NAME));
  this.subscriptionsCache = subscriptionsCache;
  this.pathSerializer = new SubscriptionAssignmentPathSerializer(basePath, AUTO_ASSIGNED_MARKER);
  this.cache = new HierarchicalCache(
      curator, Executors.newSingleThreadScheduledExecutor(), basePath, 2, Collections.emptyList()
  );
  cache.registerCallback(ASSIGNMENT_LEVEL, (e) -> {
    SubscriptionAssignment assignment =
        pathSerializer.deserialize(e.getData().getPath(), e.getData().getData());
    switch (e.getType()) {
      case CHILD_ADDED:
        onAssignmentAdded(assignment);
        break;
      case CHILD_REMOVED:
        onAssignmentRemoved(assignment);
        break;
    }
  });
}

代码示例来源:origin: pl.allegro.tech.hermes/hermes-consumers

@Inject
public SubscriptionAssignmentCache(CuratorFramework curator,
                  ConfigFactory configFactory,
                  ZookeeperPaths zookeeperPaths,
                  SubscriptionsCache subscriptionsCache) {
  this.curator = curator;
  this.basePath = zookeeperPaths.consumersRuntimePath(configFactory.getStringProperty(KAFKA_CLUSTER_NAME));
  this.subscriptionsCache = subscriptionsCache;
  this.pathSerializer = new SubscriptionAssignmentPathSerializer(basePath, AUTO_ASSIGNED_MARKER);
  this.cache = new HierarchicalCache(
      curator, Executors.newSingleThreadScheduledExecutor(), basePath, 2, Collections.emptyList()
  );
  cache.registerCallback(ASSIGNMENT_LEVEL, (e) -> {
    SubscriptionAssignment assignment =
        pathSerializer.deserialize(e.getData().getPath(), e.getData().getData());
    switch (e.getType()) {
      case CHILD_ADDED:
        onAssignmentAdded(assignment);
        break;
      case CHILD_REMOVED:
        onAssignmentRemoved(assignment);
        break;
    }
  });
}

相关文章