Sha256: bff10822ff8e4eb78854827b142487ab546fb08f31dd1106a60b34402ff1d7cc

Contents?: true

Size: 857 Bytes

Versions: 4

Compression:

Stored size: 857 Bytes

Contents

module Racecar
  class Consumer
    Subscription = Struct.new(:topic, :start_from_beginning, :max_bytes_per_partition)

    class << self
      attr_accessor :max_wait_time
      attr_accessor :group_id

      def subscriptions
        @subscriptions ||= []
      end

      # Adds one or more topic subscriptions.
      #
      # start_from_beginning    - whether to start from the beginning or the end of each
      #                           partition.
      # max_bytes_per_partition - the maximum number of bytes to fetch from each partition
      #                           at a time.
      def subscribes_to(*topics, start_from_beginning: true, max_bytes_per_partition: 1048576)
        topics.each do |topic|
          subscriptions << Subscription.new(topic, start_from_beginning, max_bytes_per_partition)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
racecar-0.3.0 lib/racecar/consumer.rb
racecar-0.3.0.beta1 lib/racecar/consumer.rb
racecar-0.2.1 lib/racecar/consumer.rb
racecar-0.2.0 lib/racecar/consumer.rb