rabbitmq-tutorials/ruby/send.rb

16 lines
283 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("hello")
ch.default_exchange.publish("Hello World!", :routing_key => q.name)
puts " [x] Sent 'Hello World!'"
conn.close