class WaterDrop::Producer::Builder

Class used to construct the rdkafka producer client

def call(producer, config)

Returns:
  • (Rdkafka::Producer, Producer::DummyClient) - raw rdkafka producer or a dummy producer

Parameters:
  • config (Object) -- dry-configurable based configuration object
  • producer (Producer) -- not yet configured producer for which we want to
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