Sha256: 791dd38743fb4672195a410f4e54d2e3426539f817a4e1fdeb4c96ae99e7dbe3
Contents?: true
Size: 942 Bytes
Versions: 1
Compression:
Stored size: 942 Bytes
Contents
require "./lib/rdkafka" task :create_topics do `kafka-topics --create --topic=produce_test_topic --zookeeper=127.0.0.1:2181 --partitions=1 --replication-factor=1` `kafka-topics --create --topic=rake_test_topic --zookeeper=127.0.0.1:2181 --partitions=1 --replication-factor=1` end task :produce_messages do producer = Rdkafka::Config.new( :"bootstrap.servers" => "localhost:9092" ).producer 100.times do |i| puts "Producing message #{i}" producer.produce( topic: "rake_test_topic", payload: "Payload #{i} from Rake", key: "Key #{i} from Rake" ).wait end end task :consume_messages do consumer = Rdkafka::Config.new( :"bootstrap.servers" => "localhost:9092", :"group.id" => "rake_test", :"enable.partition.eof" => false, :"auto.offset.reset" => "earliest" ).consumer consumer.subscribe("rake_test_topic") consumer.each do |message| puts message end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rdkafka-0.1.9 | Rakefile |