All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pl.allegro.tech.hermes.consumers.consumer.ActiveConsumerCounter Maven / Gradle / Ivy

There is a newer version: 2.10.0
Show newest version
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