18 lines
320 B
Ruby
18 lines
320 B
Ruby
#!/usr/bin/env ruby
|
|
# encoding: utf-8
|
|
|
|
require "bunny"
|
|
|
|
conn = Bunny.new(:automatically_recover => false)
|
|
conn.start
|
|
|
|
ch = conn.create_channel
|
|
q = ch.queue("task_queue", :durable => true)
|
|
|
|
msg = ARGV.empty? ? "Hello World!" : ARGV.join(" ")
|
|
|
|
q.publish(msg, :persistent => true)
|
|
puts " [x] Sent #{msg}"
|
|
|
|
conn.close
|