本文整理了Java中pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths.subscriptionPath()
方法的一些代码示例,展示了ZookeeperPaths.subscriptionPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZookeeperPaths.subscriptionPath()
方法的具体详情如下:
包路径:pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths
类名称:ZookeeperPaths
方法名:subscriptionPath
暂无
代码示例来源:origin: allegro/hermes
public String subscriptionMetricsPath(TopicName topicName, String subscriptionName) {
return subscriptionPath(topicName, subscriptionName, METRICS_PATH);
}
代码示例来源:origin: allegro/hermes
public String subscriptionMetricPath(TopicName topicName, String subscriptionName, String metricName) {
return subscriptionPath(topicName, subscriptionName, METRICS_PATH, metricName);
}
代码示例来源:origin: allegro/hermes
public String subscribedKafkaTopicsPath(TopicName topicName, String subscriptionName) {
return Joiner.on(URL_SEPARATOR).join(subscriptionPath(topicName, subscriptionName), KAFKA_TOPICS_PATH);
}
代码示例来源:origin: allegro/hermes
@Override
public boolean subscriptionExists(TopicName topicName, String subscriptionName) {
return pathExists(paths.subscriptionPath(topicName, subscriptionName));
}
代码示例来源:origin: allegro/hermes
@Override
public Optional<SentMessageTrace> last(TopicName topicName, String subscriptionName) {
try {
String path = paths.subscriptionPath(topicName, subscriptionName, NODE_NAME);
if (exists(path)) {
return Optional.of(mapper.readValue(curator.getData().forPath(path), SentMessageTrace.class));
} else {
return Optional.empty();
}
} catch (Exception e) {
throw new InternalProcessingException(
format("Could not read latest undelivered message for topic: %s and subscription: %s .",
topicName.qualifiedName(), subscriptionName),
e);
}
}
代码示例来源:origin: allegro/hermes
public String subscriptionMetricPath(SubscriptionName subscriptionName, String metricName) {
return subscriptionPath(subscriptionName.getTopicName(), subscriptionName.getName(), METRICS_PATH, metricName);
}
代码示例来源:origin: allegro/hermes
private Optional<Subscription> getSubscriptionDetails(TopicName topicName, String subscriptionName, boolean quiet) {
ensureSubscriptionExists(topicName, subscriptionName);
return readFrom(paths.subscriptionPath(topicName, subscriptionName), Subscription.class, quiet);
}
代码示例来源:origin: allegro/hermes
public String subscriptionPath(Subscription subscription) {
return subscriptionPath(subscription.getTopicName(), subscription.getName());
}
代码示例来源:origin: allegro/hermes
private void log(SentMessageTrace messageTrace) {
try {
String undeliveredPath = paths.subscriptionPath(messageTrace.getTopicName(), messageTrace.getSubscription(), NODE_NAME);
BackgroundPathAndBytesable<?> builder = exists(undeliveredPath) ? curator.setData() : curator.create();
builder.forPath(undeliveredPath, mapper.writeValueAsBytes(messageTrace));
} catch (Exception exception) {
LOGGER.warn(
format("Could not log undelivered message for topic: %s and subscription: %s",
messageTrace.getQualifiedTopicName(),
messageTrace.getSubscription()
),
exception
);
}
}
代码示例来源:origin: allegro/hermes
@Override
public void removeSubscription(TopicName topicName, String subscriptionName) {
ensureSubscriptionExists(topicName, subscriptionName);
logger.info("Removing subscription {}", new SubscriptionName(subscriptionName, topicName).getQualifiedName());
remove(paths.subscriptionPath(topicName, subscriptionName));
}
代码示例来源:origin: allegro/hermes
@Override
public void updateSubscription(Subscription modifiedSubscription) {
ensureSubscriptionExists(modifiedSubscription.getTopicName(), modifiedSubscription.getName());
logger.info("Updating subscription {}", modifiedSubscription.getQualifiedName());
overwrite(paths.subscriptionPath(modifiedSubscription), modifiedSubscription);
}
代码示例来源:origin: allegro/hermes
@Override
public void createSubscription(Subscription subscription) {
ensureConnected();
topicRepository.ensureTopicExists(subscription.getTopicName());
String subscriptionPath = paths.subscriptionPath(subscription);
logger.info("Creating subscription {}", subscription.getQualifiedName());
try {
zookeeper.create().forPath(subscriptionPath, mapper.writeValueAsBytes(subscription));
} catch (KeeperException.NodeExistsException ex) {
throw new SubscriptionAlreadyExistsException(subscription, ex);
} catch (Exception ex) {
throw new InternalProcessingException(ex);
}
}
代码示例来源:origin: allegro/hermes
@Before
public void setUp() throws Exception {
zookeeperClient.create().creatingParentsIfNeeded().forPath(paths.subscriptionPath(TOPIC, SUBSCRIPTION));
}
内容来源于网络,如有侵权,请联系作者删除!