Sha256: baf3e625ff8879df692c616e1d6531adf78364ac85e3cf5f40c0c486dbdd3806

Contents?: true

Size: 347 Bytes

Versions: 38

Compression:

Stored size: 347 Bytes

Contents

# Consumes messages from a Kafka topic.

require_relative "init"

consumer = $kafka.consumer(group_id: "greetings-group")
consumer.subscribe("greetings")

num_messages = 0

trap("TERM") { consumer.stop }

consumer.each_message do |message|
  num_messages += 1

  if num_messages % 1000 == 0
    puts "Processed #{num_messages} messages"
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
ruby-kafka-0.5.2 ci/consumer.rb
ruby-kafka-0.5.2.beta3 ci/consumer.rb
ruby-kafka-0.5.2.beta2 ci/consumer.rb
ruby-kafka-0.5.2.beta1 ci/consumer.rb
ruby-kafka-0.5.1 ci/consumer.rb
ruby-kafka-0.5.1.beta2 ci/consumer.rb
ruby-kafka-0.5.1.beta1 ci/consumer.rb
ruby-kafka-0.4.4 ci/consumer.rb
ruby-kafka-0.5.0 ci/consumer.rb
ruby-kafka-0.5.0.beta6 ci/consumer.rb
ruby-kafka-0.5.0.beta5 ci/consumer.rb
ruby-kafka-0.5.0.beta4 ci/consumer.rb
ruby-kafka-0.5.0.beta3 ci/consumer.rb
ruby-kafka-0.5.0.beta2 ci/consumer.rb
ruby-kafka-0.4.3 ci/consumer.rb
ruby-kafka-0.4.2 ci/consumer.rb
ruby-kafka-0.4.1 ci/consumer.rb
ruby-kafka-0.4.0 ci/consumer.rb
ruby-kafka-0.4.0.beta1 ci/consumer.rb
ruby-kafka-0.3.18.beta2 ci/consumer.rb