Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'bunny'
- raise 'invalid message size' unless ARGV[0] =~ /^[0-9]+$/
- c = Bunny.new(:host => 'mq1', :user => 'admin', :password => 'passwd', :automatically_recover => false)
- c.start
- ch = c.create_channel
- q = ch.queue('test-queue')
- puts "(started) #{Time.now}"
- begin
- loop { q.publish('a' * ARGV[0].to_i) }
- rescue Bunny::NetworkFailure => _
- puts "(aborted) #{Time.now}"
- rescue Exception => _
- ch.close
- c.close
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement