Class FlatBinaryMaxRateRegistry

  • All Implemented Interfaces:
    org.apache.curator.framework.recipes.cache.NodeCacheListener, MaxRateRegistry

    public class FlatBinaryMaxRateRegistry
    extends java.lang.Object
    implements MaxRateRegistry, org.apache.curator.framework.recipes.cache.NodeCacheListener
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.ConsumerRateInfo> ensureCorrectAssignments​(pl.allegro.tech.hermes.api.SubscriptionName subscriptionName, java.util.Set<java.lang.String> currentConsumers)  
      java.util.Optional<pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.MaxRate> getMaxRate​(pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.ConsumerInstance consumer)  
      RateHistory getRateHistory​(pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.ConsumerInstance consumer)  
      void nodeChanged()  
      void onAfterMaxRateCalculation()  
      void onAfterWriteRateHistories()  
      void onBeforeMaxRateCalculation()  
      void start()  
      void stop()  
      void update​(pl.allegro.tech.hermes.api.SubscriptionName subscriptionName, java.util.Map<java.lang.String,​pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.MaxRate> newMaxRates)  
      void writeRateHistory​(pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.ConsumerInstance consumer, RateHistory rateHistory)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FlatBinaryMaxRateRegistry

        public FlatBinaryMaxRateRegistry​(pl.allegro.tech.hermes.common.config.ConfigFactory configFactory,
                                         ClusterAssignmentCache clusterAssignmentCache,
                                         ConsumerAssignmentCache consumerAssignmentCache,
                                         org.apache.curator.framework.CuratorFramework curator,
                                         pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths zookeeperPaths,
                                         SubscriptionIds subscriptionIds)
    • Method Detail

      • ensureCorrectAssignments

        public java.util.Set<pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.ConsumerRateInfo> ensureCorrectAssignments​(pl.allegro.tech.hermes.api.SubscriptionName subscriptionName,
                                                                                                                               java.util.Set<java.lang.String> currentConsumers)
        Specified by:
        ensureCorrectAssignments in interface MaxRateRegistry
      • update

        public void update​(pl.allegro.tech.hermes.api.SubscriptionName subscriptionName,
                           java.util.Map<java.lang.String,​pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.MaxRate> newMaxRates)
        Specified by:
        update in interface MaxRateRegistry
      • getMaxRate

        public java.util.Optional<pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.MaxRate> getMaxRate​(pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.ConsumerInstance consumer)
        Specified by:
        getMaxRate in interface MaxRateRegistry
      • writeRateHistory

        public void writeRateHistory​(pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.ConsumerInstance consumer,
                                     RateHistory rateHistory)
        Specified by:
        writeRateHistory in interface MaxRateRegistry
      • nodeChanged

        public void nodeChanged()
        Specified by:
        nodeChanged in interface org.apache.curator.framework.recipes.cache.NodeCacheListener