Class: WaterDrop::Producer::Builder
- Inherits:
-
Object
- Object
- WaterDrop::Producer::Builder
- Defined in:
- lib/waterdrop/producer/builder.rb
Overview
Class used to construct the rdkafka producer client
Instance Method Summary collapse
-
#call(producer, config) ⇒ Rdkafka::Producer, Producer::DummyClient
Raw rdkafka producer or a dummy producer when we don’t want to dispatch any messages.
Instance Method Details
#call(producer, config) ⇒ Rdkafka::Producer, Producer::DummyClient
Returns raw rdkafka producer or a dummy producer when we don’t want to dispatch any messages.
12 13 14 15 16 17 18 19 20 |
# File 'lib/waterdrop/producer/builder.rb', line 12 def call(producer, config) klass = config.client_class # This allows us to have backwards compatibility. # If it is the default client and delivery is set to false, we use dummy as we used to # before `client_class` was introduced klass = Clients::Dummy if klass == Clients::Rdkafka && !config.deliver klass.new(producer) end |