WaterDrop reconfiguration
Important
GitHub Wiki is just a mirror of our online documentation.
We highly recommend using our website docs due to Github Wiki limitations. Only some illustrations, links, screencasts, and code examples will work here, and the formatting may be broken.
Please use https://karafka.io/docs.
WaterDrop is a standalone messages producer integrated with Karafka out of the box.
Karafka comes with full WaterDrop support. It also integrates automatically with it, populating all the options related to Kafka that were set during the Karafka framework configuration.
In case you want to change WaterDrop configuration settings, you can do this by overwriting the default producer
while configuring the Karafka application:
class KarafkaApp < Karafka::App
setup do |config|
# Karafka config...
config.client_id = ::Settings.name
config.producer = ::WaterDrop::Producer.new do |p_config|
p_config.kafka = {
'bootstrap.servers': 'localhost:9092',
'request.required.acks': 1
}
end
end
routes.draw do
# consumer groups definitions go here
end
end
There are scenarios where you want only partially to overwrite the configuration and change one or two attributes. In cases like this, to not duplicate the Kafka cluster configuration, you can use the Karafka::Setup::AttributesMap
. For example, you may want to disable dispatch to Kafka altogether in test
env:
class KarafkaApp < Karafka::App
setup do |config|
# Karafka config...
config.client_id = ::Settings.name
config.producer = ::WaterDrop::Producer.new do |p_config|
# Copy the default config, filtering out non-producer related settings
p_config.kafka = ::Karafka::Setup::AttributesMap.producer(config.kafka.dup)
# share the Karafka logger
p_config.logger = config.logger
# Any reconfiguration you want goes here
#
# Do not send messages to Kafka in test env
p_config.deliver = !Karafka.env.test?
end
end
end
Home | Getting started | Components | Producing Messages | Consuming messages | Concurrency and multithreading | Error handling and back off policy
This wiki is tracked by git and publicly editable. You are welcome to fix errors and typos. Any defacing or vandalism of content will result in your changes being reverted and you being blocked.