Sha256: 5296d1a97c4e906a66667887fe4db533d960c9aeca785c23eeeca0bfb8e48b20
Contents?: true
Size: 565 Bytes
Versions: 5
Compression:
Stored size: 565 Bytes
Contents
$LOAD_PATH.unshift(File.expand_path("../../lib", __FILE__)) require "kafka" logger = Logger.new(STDOUT) brokers = ENV.fetch("KAFKA_BROKERS", "localhost:9092").split(",") # Make sure to create this topic in your Kafka cluster or configure the # cluster to auto-create topics. topic = "text" kafka = Kafka.new( seed_brokers: brokers, client_id: "test", socket_timeout: 20, logger: logger, ) consumer = kafka.consumer(group_id: "test") consumer.subscribe(topic) trap("TERM") { consumer.stop } consumer.each_message do |message| puts message.value end
Version data entries
5 entries across 5 versions & 1 rubygems