Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ⚡ cat mcollective-many-client
- #!/usr/bin/env ruby
- require 'rubygems'
- gem 'stomp', '=1.2.11'
- require 'mcollective'
- include MCollective::RPC
- c = rpcclient("rpcutil")
- server_count = ARGV[0] || "1"
- server_count = server_count.to_i
- reply_to = "/queue/global.reply.spammy_#{$$}"
- connection = MCollective::PluginManager["connector_plugin"].connection
- connection.subscribe(reply_to)
- body = "I know a song that'll get on your nerves\n" * 13 # about 500 bytes, same as a rpc rpcutil ping
- 1000.times do |i|
- expires = ((Time.now.to_i + 60) * 1000).to_s
- 1000.times do |j|
- server = j % server_count
- identity = "#{i}-#{j}-#{server}"
- connection.publish('/queue/tive.nodes', body, {
- "mc_traceme" => identity,
- "mc_identity" => "mini-server#{server}.example.com",
- "reply-to" => reply_to,
- # "expires" => expires,
- })
- puts "#{Time.now.to_f} sent #{identity}"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment