Sha256: c073d043b885aa2c69712c22b379cc0e4c40e60c888d00262e55b4e5707f8014

Contents?: true

Size: 654 Bytes

Versions: 37

Compression:

Stored size: 654 Bytes

Contents

#!/usr/bin/env ruby
# encoding: utf-8

require "rubygems"
require "bunny"

STDOUT.sync = true

puts "=> Demonstrating alternate exchanges"
puts

conn = Bunny.new
conn.start

ch   = conn.create_channel
x1   = ch.fanout("bunny.examples.ae.exchange1", :auto_delete => true, :durable => false)
x2   = ch.fanout("bunny.examples.ae.exchange2", :auto_delete => true, :durable => false, :arguments => {
                   "alternate-exchange" => x1.name
                 })
q    = ch.queue("", :exclusive => true)
q.bind(x1)

x2.publish("")

sleep 0.2
puts "Queue #{q.name} now has #{q.message_count} message in it"

sleep 0.7
puts "Disconnecting..."
conn.close

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
bunny-2.17.0 examples/guides/extensions/alternate_exchange.rb
bunny-2.16.1 examples/guides/extensions/alternate_exchange.rb
bunny-2.15.0 examples/guides/extensions/alternate_exchange.rb
bunny-2.14.4 examples/guides/extensions/alternate_exchange.rb
bunny-2.14.3 examples/guides/extensions/alternate_exchange.rb
bunny-2.14.2 examples/guides/extensions/alternate_exchange.rb
bunny-2.14.1 examples/guides/extensions/alternate_exchange.rb
bunny-2.13.0 examples/guides/extensions/alternate_exchange.rb
bunny-2.12.1 examples/guides/extensions/alternate_exchange.rb
bunny-2.12.0 examples/guides/extensions/alternate_exchange.rb
bunny-2.12.0.rc1 examples/guides/extensions/alternate_exchange.rb
bunny-2.11.0 examples/guides/extensions/alternate_exchange.rb
bunny-2.11.0.pre1 examples/guides/extensions/alternate_exchange.rb
bunny-2.10.0 examples/guides/extensions/alternate_exchange.rb
bunny-2.9.2 examples/guides/extensions/alternate_exchange.rb
bunny-2.9.1 examples/guides/extensions/alternate_exchange.rb
bunny-2.6.7 examples/guides/extensions/alternate_exchange.rb
bunny-2.7.4 examples/guides/extensions/alternate_exchange.rb
bunny-2.8.1 examples/guides/extensions/alternate_exchange.rb
bunny-2.9.0 examples/guides/extensions/alternate_exchange.rb