Skip to content

Instantly share code, notes, and snippets.

@solars
Created October 6, 2011 13:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solars/1267340 to your computer and use it in GitHub Desktop.
Save solars/1267340 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# encoding: utf-8
require "rubygems"
require "bundler"
Bundler.setup
require 'amqp'
EventMachine.run do
connection = AMQP.connect(:host => 'localhost', :user => 'guest', :pass => 'guest')
puts "Connecting to AMQP broker. Running #{AMQP::VERSION} version of the gem..."
channel = AMQP::Channel.new(connection)
queue = channel.queue("reservations.local")
exchange = channel.default_exchange
puts "publishing"
exchange.publish "test", :routing_key => 'reservations.local', :ack => true
connection.close { EventMachine.stop }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment