Module: Karafka::Setup::DefaultsInjector
- Defined in:
- lib/karafka/setup/defaults_injector.rb
Overview
Injector that enriches each Kafka cluster with needed defaults. User may use more than one cluster and define them on a per-topic basis. We use this when we build the final config per subscription group.
Class Method Summary collapse
-
.consumer(kafka_config) ⇒ Object
Propagates the kafka setting defaults unless they are already present for consumer config This makes it easier to set some values that users usually don’t change but still allows them to overwrite the whole hash if they want to.
Class Method Details
.consumer(kafka_config) ⇒ Object
Propagates the kafka setting defaults unless they are already present for consumer config This makes it easier to set some values that users usually don’t change but still allows them to overwrite the whole hash if they want to
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/karafka/setup/defaults_injector.rb', line 46 def consumer(kafka_config) CONSUMER_KAFKA_DEFAULTS.each do |key, value| next if kafka_config.key?(key) kafka_config[key] = value end return if Karafka::App.env.production? CONSUMER_KAFKA_DEV_DEFAULTS.each do |key, value| next if kafka_config.key?(key) kafka_config[key] = value end end |