Module: Phobos
- Extended by:
- Configuration
- Defined in:
- lib/phobos/deep_struct.rb,
lib/phobos.rb,
lib/phobos/cli.rb,
lib/phobos/log.rb,
lib/phobos/errors.rb,
lib/phobos/handler.rb,
lib/phobos/version.rb,
lib/phobos/executor.rb,
lib/phobos/listener.rb,
lib/phobos/producer.rb,
lib/phobos/cli/start.rb,
lib/phobos/constants.rb,
lib/phobos/processor.rb,
lib/phobos/cli/runner.rb,
lib/phobos/test/helper.rb,
lib/phobos/echo_handler.rb,
lib/phobos/batch_handler.rb,
lib/phobos/batch_message.rb,
lib/phobos/configuration.rb,
lib/phobos/instrumentation.rb,
lib/phobos/actions/process_batch.rb,
lib/phobos/actions/process_message.rb,
lib/phobos/actions/process_batch_inline.rb
Overview
Please use this with at least the same consideration as you would when using OpenStruct. Right now we only use this to parse our internal configuration files. It is not meant to be used on incoming data.
Defined Under Namespace
Modules: Actions, BatchHandler, Configuration, Constants, Handler, Instrumentation, Log, LoggerHelper, Processor, Producer, Test
Classes: AbortError, BatchMessage, DeepStruct, EchoHandler, Error, Executor, Listener
Constant Summary
collapse
- VERSION =
'2.1.6'
Class Attribute Summary collapse
Class Method Summary
collapse
configure, configure_logger
Class Attribute Details
56
57
58
|
# File 'lib/phobos.rb', line 56
def config
@config
end
|
.logger ⇒ Logger
58
59
60
|
# File 'lib/phobos.rb', line 58
def logger
@logger
end
|
.silence_log ⇒ Boolean
60
61
62
|
# File 'lib/phobos.rb', line 60
def silence_log
@silence_log
end
|
Class Method Details
.add_listeners(configuration) ⇒ void
This method returns an undefined value.
64
65
66
67
|
# File 'lib/phobos.rb', line 64
def add_listeners(configuration)
listeners_config = fetch_configuration(configuration)
@config.listeners += listeners_config.listeners
end
|
.create_exponential_backoff(backoff_config = nil) ⇒ Object
81
82
83
84
85
86
|
# File 'lib/phobos.rb', line 81
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
|
.create_kafka_client(config_key = nil) ⇒ Object
70
71
72
73
74
75
76
77
78
|
# File 'lib/phobos.rb', line 70
def create_kafka_client(config_key = nil)
kafka_config = config.kafka.to_hash.merge(logger: @ruby_kafka_logger)
if config_key
kafka_config = kafka_config.merge(**config.send(config_key)&.kafka&.to_hash || {})
end
Kafka.new(**kafka_config)
end
|
.deprecate(message) ⇒ void
This method returns an undefined value.
90
91
92
93
|
# File 'lib/phobos.rb', line 90
def deprecate(message)
location = caller.find { |line| line !~ %r{/phobos/} }
warn "DEPRECATION WARNING: #{message}: #{location}"
end
|