Not able to stop consumer in ruby-kafka, waiting for messages infinitely

RV_Dev Source

I am using ruby-kafak to read messages from consumer but I am not able to stop consumer and go to next steps.

consumer = kafka.consumer(
          group_id: 'test_ruchi',
          # Increase offset commit frequency to once every 5 seconds.
          offset_commit_interval: 5,

          # Commit offsets when 100 messages have been processed.
          offset_commit_threshold: 100,

          # Increase the length of time that committed offsets are kept.
          offset_retention_time: 7 * 60 * 60
      trap("INT") {consumer.close}
      trap("TERM") {consumer.stop}

trap in current code is not working for me



comments powered by Disqus