rabbitmq-tutorials/ruby/emit_log.rb
2013-07-17 23:11:23 +04:00

19 lines
255 B
Ruby

#!/usr/bin/env ruby
# encoding: utf-8
require "bunny"
conn = Bunny.new
conn.start
ch = conn.create_channel
x = ch.fanout("logs")
msg = ARGV.empty? ? "Hello World!" : ARGV.join(" ")
x.publish(msg)
puts " [x] Sent '#{msg}'"
sleep 0.5
conn.close