Skip to content

Commit

Permalink
test app for many connections
Browse files Browse the repository at this point in the history
  • Loading branch information
carlhoerberg committed Jan 22, 2020
1 parent 28cec9f commit 830d6b1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/many_conns.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require "amqp-client"

abort "Usage: #{PROGRAM_NAME} <amqp-url> <client-count> <msg-count-per-client>" if ARGV.size != 3
url, conns, msgs = ARGV
puts "Publishing #{msgs} msgs on #{conns} connections"
done = Channel(Nil).new
conns.to_i.times do |idx|
spawn do
AMQP::Client.start(url) do |c|
c.channel do |ch|
q = ch.queue("test")
msgs.to_i.times do |idx|
q.publish "msg #{idx}"
end
end
end
ensure
done.send nil
end
end

conns.to_i.times do
done.receive?
end

0 comments on commit 830d6b1

Please sign in to comment.