mirror of https://github.com/reiseburo/hermann
add mri script
This commit is contained in:
parent
dd25bc9586
commit
8b7a31a232
|
@ -0,0 +1,25 @@
|
|||
require 'rubygems'
|
||||
|
||||
$LOAD_PATH << File.dirname(__FILE__) + "/../lib"
|
||||
$LOAD_PATH << File.dirname(__FILE__) + "/../ext"
|
||||
require 'hermann'
|
||||
require 'hermann/consumer'
|
||||
|
||||
t1 = 0
|
||||
threads = []
|
||||
100.times do |i|
|
||||
threads << Thread.new do
|
||||
puts "booting #{i}"
|
||||
c = Hermann::Consumer.new( "maxwell", brokers: "localhost:9092", partition: i, offset: :start)
|
||||
c.consume() do
|
||||
|msg| puts("Received: #{msg}")
|
||||
if(t1 == 0)
|
||||
t1 = Time.now
|
||||
end
|
||||
t2 = Time.now
|
||||
elapsed = t2 - t1
|
||||
puts("Total elapsed time: #{elapsed} seconds")
|
||||
end
|
||||
end
|
||||
end
|
||||
threads.each(&:join)
|
Loading…
Reference in New Issue