Sha256: cd7e02d067966f1fff854fdb0385e401ce0d3a1a9e4eaf4805428efdc8865c8a

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

module Racecar
  class RebalanceListener
    def initialize(config)
      @config = config
      @consumer_class = config.consumer_class
    end

    attr_reader :config, :consumer_class

    def on_partitions_assigned(_consumer, topic_partition_list)
      consumer_class.respond_to?(:on_partitions_assigned) &&
        consumer_class.on_partitions_assigned(topic_partition_list.to_h)
    rescue
    end

    def on_partitions_revoked(_consumer, topic_partition_list)
      consumer_class.respond_to?(:on_partitions_revoked) &&
        consumer_class.on_partitions_revoked(topic_partition_list.to_h)
    rescue
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
racecar-2.9.0 lib/racecar/rebalance_listener.rb