Sha256: 1f0a3f78287291103aa7528d7a116a10bd4df73ee2b5db1294ec492694073bde
Contents?: true
Size: 908 Bytes
Versions: 8
Compression:
Stored size: 908 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| 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
8 entries across 8 versions & 1 rubygems
Version | Path |
---|---|
rdkafka-0.1.8 | Rakefile |
rdkafka-0.1.7 | Rakefile |
rdkafka-0.1.6 | Rakefile |
rdkafka-0.1.5 | Rakefile |
rdkafka-0.1.4 | Rakefile |
rdkafka-0.1.3 | Rakefile |
rdkafka-0.1.2 | Rakefile |
rdkafka-0.1.1 | Rakefile |