Guest User

Untitled

a guest
Jan 14th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #!/usr/bin/env ruby
  2. # encoding: utf-8
  3.  
  4. require "rubygems"
  5. require "bundler"
  6. Bundler.setup
  7.  
  8. require 'amqp'
  9.  
  10. EventMachine.run do
  11. connection = AMQP.connect(:host => 'localhost', :user => 'guest', :pass => 'guest')
  12. puts "Connecting to AMQP broker. Running #{AMQP::VERSION} version of the gem..."
  13. channel = AMQP::Channel.new(connection)
  14. queue = channel.queue("reservations.local")
  15. exchange = channel.default_exchange
  16. puts "publishing"
  17. exchange.publish "test", :routing_key => 'reservations.local', :ack => true
  18. connection.close { EventMachine.stop }
  19. end
Add Comment
Please, Sign In to add comment