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

pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.MaxRateRegistryPaths Maven / Gradle / Ivy

There is a newer version: 2.10.0
Show newest version
package pl.allegro.tech.hermes.consumers.consumer.rate.maxrate;

import pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths;

import static pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths.CONSUMERS_RATE_PATH;
import static pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths.MAX_RATE_HISTORY_PATH;
import static pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths.MAX_RATE_PATH;

class MaxRateRegistryPaths {

    private static final String RATE_RUNTIME_PATH = "runtime-bin";

    private final ZookeeperPaths zookeeperPaths;
    private final String clusterName;
    private final String currentConsumerRateHistoryPath;

    MaxRateRegistryPaths(ZookeeperPaths zookeeperPaths, String currentConsumerId, String clusterName) {
        this.zookeeperPaths = zookeeperPaths;
        this.clusterName = clusterName;
        this.currentConsumerRateHistoryPath = consumerRateHistoryPath(currentConsumerId);
    }

    String consumerMaxRatePath(String consumerId) {
        return zookeeperPaths.join(consumerRateParentRuntimePath(consumerId), MAX_RATE_PATH);
    }

    String consumerRateHistoryPath(String consumerId) {
        return zookeeperPaths.join(consumerRateParentRuntimePath(consumerId), MAX_RATE_HISTORY_PATH);
    }

    String consumerRateParentRuntimePath(String consumerId) {
        return zookeeperPaths.join(consumersRateCurrentClusterRuntimeBinaryPath(), consumerId);
    }

    String consumersRateCurrentClusterRuntimeBinaryPath() {
        return zookeeperPaths.join(zookeeperPaths.basePath(), CONSUMERS_RATE_PATH, clusterName, RATE_RUNTIME_PATH);
    }

    String currentConsumerRateHistoryPath() {
        return currentConsumerRateHistoryPath;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy