Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (20 sloc) 749 Bytes
# encoding: utf-8
# simple.rb
# Assumes that target message broker/server has a user called 'guest' with a password 'guest'
# and that it is running on 'localhost'.
# If this is not the case, please change the '' call below to include
# the relevant arguments e.g. b = => 'john', :pass => 'doe', :host => 'foobar')
$:.unshift File.dirname(__FILE__) + '/../lib'
require 'bunny'
b = => true)
# start a communication session with the amqp server
# declare a queue
q = b.queue('test1')
# publish a message to the queue
q.publish('➸ Hello everybody ☺!')
# get message from the queue
msg = q.pop[:payload]
puts 'This is the message: ' + msg + "\n\n"
# close the client connection
Jump to Line
Something went wrong with that request. Please try again.