Class MaxRateRegistry

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

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

      Constructors 
      Constructor Description
      MaxRateRegistry​(int historiesEncoderBufferSize, int maxRateEncoderBufferSize, java.lang.String nodeId, java.lang.String clusterName, ClusterAssignmentCache clusterAssignmentCache, ConsumerAssignmentCache consumerAssignmentCache, org.apache.curator.framework.CuratorFramework curator, pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths zookeeperPaths, SubscriptionIds subscriptionIds)  
    • 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

      • MaxRateRegistry

        public MaxRateRegistry​(int historiesEncoderBufferSize,
                               int maxRateEncoderBufferSize,
                               java.lang.String nodeId,
                               java.lang.String clusterName,
                               ClusterAssignmentCache clusterAssignmentCache,
                               ConsumerAssignmentCache consumerAssignmentCache,
                               org.apache.curator.framework.CuratorFramework curator,
                               pl.allegro.tech.hermes.infrastructure.zookeeper.ZookeeperPaths zookeeperPaths,
                               SubscriptionIds subscriptionIds)
    • Method Detail

      • start

        public void start()
      • stop

        public void stop()
      • onBeforeMaxRateCalculation

        public void onBeforeMaxRateCalculation()
      • onAfterMaxRateCalculation

        public void onAfterMaxRateCalculation()
      • 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)
      • 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)
      • 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)
      • getRateHistory

        public RateHistory getRateHistory​(pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.ConsumerInstance consumer)
      • writeRateHistory

        public void writeRateHistory​(pl.allegro.tech.hermes.consumers.consumer.rate.maxrate.ConsumerInstance consumer,
                                     RateHistory rateHistory)
      • onAfterWriteRateHistories

        public void onAfterWriteRateHistories()
      • nodeChanged

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