Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'amqp'
- require 'rubygems'
- require 'bunny'
- require 'eventmachine'
- connection = Bunny.new
- connection.start
- channel = connection.create_channel
- queue = channel.queue('hello')
- begin
- puts ' [*] Waiting for messages. To exit press CTRL+C'
- queue.subscribe(block: true) do |metadata, payload|
- puts " [x] Received #{payload}"
- end
- rescue Interrupt => _
- connection.close
- exit(0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement