Module: Karafka::Patches::Rdkafka::Opaque

Defined in:
lib/karafka/patches/rdkafka/opaque.rb

Overview

Patches allowing us to run events on both pre and post rebalance events. Thanks to that, we can easily connect to the whole flow despite of the moment when things are happening

Instance Method Summary collapse

Instance Method Details

#call_on_partitions_assign(tpl) ⇒ Object

Handles pre-assign phase of rebalance

Parameters:

  • tpl (Rdkafka::Consumer::TopicPartitionList)


13
14
15
16
17
18
# File 'lib/karafka/patches/rdkafka/opaque.rb', line 13

def call_on_partitions_assign(tpl)
  return unless consumer_rebalance_listener
  return unless consumer_rebalance_listener.respond_to?(:on_partitions_assign)

  consumer_rebalance_listener.on_partitions_assign(tpl)
end

#call_on_partitions_revoke(tpl) ⇒ Object

Handles pre-revoke phase of rebalance

Parameters:

  • tpl (Rdkafka::Consumer::TopicPartitionList)


23
24
25
26
27
28
# File 'lib/karafka/patches/rdkafka/opaque.rb', line 23

def call_on_partitions_revoke(tpl)
  return unless consumer_rebalance_listener
  return unless consumer_rebalance_listener.respond_to?(:on_partitions_revoke)

  consumer_rebalance_listener.on_partitions_revoke(tpl)
end