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.5.3 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.5.2 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.5.1 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.5.0 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.11 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.10 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.9 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.8 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.7 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.6 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.5 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.4 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.3 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.2 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.1 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.4.0 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.3.3 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.3.2 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.3.1 lib/waterdrop/producer/dummy_client.rb
waterdrop-2.3.0 lib/waterdrop/producer/dummy_client.rb