Class: WaterDrop::Clients::Dummy
- Inherits:
-
Object
- Object
- WaterDrop::Clients::Dummy
- Defined in:
- lib/waterdrop/clients/dummy.rb
Overview
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.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(_producer) ⇒ Dummy
constructor
Dummy instance.
-
#method_missing(*_args) ⇒ self
Returns self for chaining cases.
- #respond_to_missing?(*_args) ⇒ Boolean
-
#wait(*_args) ⇒ ::Rdkafka::Producer::DeliveryReport
Dummy method for returning the delivery report.
Constructor Details
#initialize(_producer) ⇒ Dummy
Returns dummy instance.
12 13 14 |
# File 'lib/waterdrop/clients/dummy.rb', line 12 def initialize(_producer) @counter = -1 end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*_args) ⇒ self
Returns self for chaining cases
30 31 32 |
# File 'lib/waterdrop/clients/dummy.rb', line 30 def method_missing(*_args) self || super end |
Instance Method Details
#respond_to_missing?(*_args) ⇒ Boolean
24 25 26 |
# File 'lib/waterdrop/clients/dummy.rb', line 24 def respond_to_missing?(*_args) true end |
#wait(*_args) ⇒ ::Rdkafka::Producer::DeliveryReport
Dummy method for returning the delivery report
19 20 21 |
# File 'lib/waterdrop/clients/dummy.rb', line 19 def wait(*_args) ::Rdkafka::Producer::DeliveryReport.new(0, @counter += 1) end |