Sha256: 4ec6b2db5640717031fde19451d9b963df9123b9abb8478a73c9eac39ed474f8

Contents?: true

Size: 981 Bytes

Versions: 31

Compression:

Stored size: 981 Bytes

Contents

# frozen_string_literal: true

module WaterDrop
  class Producer
    # A dummy client that is supposed to be used instead of Rdkafka::Producer in case we don't
    # want to dispatch anything to Kafka
    class DummyClient
      # @return [DummyClient] dummy instance
      def initialize
        @counter = -1
      end

      # Dummy method for returning the delivery report
      # @param _args [Object] anything that the delivery handle accepts
      # @return [::Rdkafka::Producer::DeliveryReport]
      def wait(*_args)
        ::Rdkafka::Producer::DeliveryReport.new(0, @counter += 1)
      end

      # @param _args [Object] anything really, this dummy is suppose to support anything
      def respond_to_missing?(*_args)
        true
      end

      # @param _args [Object] anything really, this dummy is suppose to support anything
      # @return [self] returns self for chaining cases
      def method_missing(*_args)
        self || super
      end
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
waterdrop-2.2.0 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.1.0 lib/water_drop/producer/dummy_client.rb
waterdrop-2.0.7 lib/water_drop/producer/dummy_client.rb
waterdrop-2.0.6 lib/water_drop/producer/dummy_client.rb
waterdrop-2.0.5 lib/water_drop/producer/dummy_client.rb
waterdrop-2.0.4 lib/water_drop/producer/dummy_client.rb
waterdrop-2.0.3 lib/water_drop/producer/dummy_client.rb
waterdrop-2.0.2 lib/water_drop/producer/dummy_client.rb
waterdrop-2.0.1 lib/water_drop/producer/dummy_client.rb
waterdrop-2.0.0 lib/water_drop/producer/dummy_client.rb
waterdrop-2.0.0.rc1 lib/water_drop/producer/dummy_client.rb