class WaterDrop::Clients::Dummy
A dummy client that is supposed to be used instead of Rdkafka::Producer in case we don’t want to dispatch anything to Kafka.
It does not store anything and just ignores messages. It does however return proper delivery handle that can be materialized into a report.
Public Class Methods
Source
# File lib/waterdrop/clients/dummy.rb, line 44 def initialize(_producer) @counters = Hash.new { |h, k| h[k] = -1 } end
@param _producer [WaterDrop::Producer] @return [Dummy] dummy instance
Public Instance Methods
Source
# File lib/waterdrop/clients/dummy.rb, line 64 def method_missing(*_args) self || super end
@param _args [Object] anything really, this dummy is suppose to support anything @return [self] returns self for chaining cases
Source
# File lib/waterdrop/clients/dummy.rb, line 53 def produce(topic:, partition: 0, **_args) Handle.new(topic.to_s, partition, @counters["#{topic}#{partition}"] += 1) end
“Produces” the message @param topic [String, Symbol] topic where we want to dispatch message @param partition [Integer] target partition @param _args [Hash] remaining details that are ignored in the dummy mode @return [Handle] delivery handle
Source
# File lib/waterdrop/clients/dummy.rb, line 58 def respond_to_missing?(*_args) true end
@param _args [Object] anything really, this dummy is suppose to support anything