kafkaex/kafka_ex

How to gracefully shutdown consumer group?

lessless opened this issue · 0 comments

Hi,

I'm looking for a way to gracefully shutdown a consumer group.

Let's say there is a setting that can be flipped to turn off consumption and that setting can be checked in handle_message_set.

 def handle_message_set(message_set, state) do
    do_some_job(message_set)
    if Settings.stop?() do
      commit_and_shutdown()
    else 
      commit()
    end
  end

The absolute must here is to no receive any new messages even if the cluster undergoes a rebalance.