public RebalanceListener(IPartitionEventHandler <K, V> partitionEventHandler, KafkaConsumerActor <K, V> actor) { _partitionEventHandler = partitionEventHandler; _actor = actor; var restrictedConsumerTimeoutMs = Math.Round(actor._settings.PartitionHandlerWarning.TotalMilliseconds * 0.95); _restrictedConsumer = new RestrictedConsumer <K, V>(actor._consumer, TimeSpan.FromMilliseconds(restrictedConsumerTimeoutMs)); _warningDuration = actor._settings.PartitionHandlerWarning; }
/// <summary> /// KafkaConsumerActor /// </summary> /// <param name="owner">Owner actor to send critical failures to</param> /// <param name="settings">Consumer settings</param> /// <param name="statisticsHandler">Statistics handler</param> /// <param name="partitionEventHandler">Partion events handler</param> public KafkaConsumerActor(IActorRef owner, ConsumerSettings <K, V> settings, IPartitionEventHandler partitionEventHandler, IStatisticsHandler statisticsHandler) { _owner = owner; _settings = settings; _statisticsHandler = statisticsHandler; _partitionEventHandler = partitionEventHandler; var restrictedConsumerTimeoutMs = Math.Round(_settings.PartitionHandlerWarning.TotalMilliseconds * 0.95); _restrictedConsumer = new RestrictedConsumer <K, V>(_consumer, TimeSpan.FromMilliseconds(restrictedConsumerTimeoutMs)); _warningDuration = _settings.PartitionHandlerWarning; _pollMessage = new Internal.Poll <K, V>(this, periodic: true); _delayedPollMessage = new Internal.Poll <K, V>(this, periodic: false); _log = Context.GetLogger(); }