lib/phobos.rb in phobos-1.4.2 vs lib/phobos.rb in phobos-1.5.0

- old
+ new

@@ -7,16 +7,19 @@ require 'active_support/notifications' require 'concurrent' require 'exponential_backoff' require 'kafka' require 'logging' +require 'erb' require 'phobos/deep_struct' require 'phobos/version' require 'phobos/instrumentation' require 'phobos/errors' require 'phobos/listener' +require 'phobos/actions/process_batch' +require 'phobos/actions/process_message' require 'phobos/producer' require 'phobos/handler' require 'phobos/echo_handler' require 'phobos/executor' @@ -38,12 +41,13 @@ def create_kafka_client Kafka.new(config.kafka.to_hash.merge(logger: @ruby_kafka_logger)) end - def create_exponential_backoff - min = Phobos.config.backoff.min_ms / 1000.0 - max = Phobos.config.backoff.max_ms / 1000.0 + def create_exponential_backoff(backoff_config = nil) + backoff_config ||= Phobos.config.backoff.to_hash + min = backoff_config[:min_ms] / 1000.0 + max = backoff_config[:max_ms] / 1000.0 ExponentialBackoff.new(min, max).tap { |backoff| backoff.randomize_factor = rand } end def configure_logger log_file = config.logger.file