Skip to content

@vsavkin /example2.rb
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Example 2 for "Messaging for Rubyists"
require 'bunny'
# connecting to a broker
b = Bunny.new({}, {:spec => "09"})
b.start
# setup
e = b.exchange("exchange-02", :durable => true)
q = b.queue("queue-02")
q.bind e
# producer
e.publish("Message Body", :persistent => true)
# consumer
msg = q.pop
puts "This is the message: #{msg}"
puts "This is the payload: #{msg[:payload]}"
b.stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.