pl.allegro.tech.hermes.consumers.consumer.ActiveConsumerCounter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hermes-consumers Show documentation
Show all versions of hermes-consumers Show documentation
Fast and reliable message broker built on top of Kafka.
package pl.allegro.tech.hermes.consumers.consumer;
import pl.allegro.tech.hermes.api.Subscription;
import pl.allegro.tech.hermes.common.metric.counter.CounterStorage;
import javax.inject.Inject;
public class ActiveConsumerCounter {
private final CounterStorage counterStorage;
@Inject
public ActiveConsumerCounter(CounterStorage counterStorage) {
this.counterStorage = counterStorage;
}
public int countActiveConsumers(Subscription subscription) {
// This is an ad-hoc implementation, utilizing exising inflight nodes.
return counterStorage.countInflightNodes(subscription.getTopicName(), subscription.getName());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy