Sha256: 866264b6c3404a7962523c6c04d1e49152ff9a9ff8df673005bd28a3d4f7936c

Contents?: true

Size: 634 Bytes

Versions: 87

Compression:

Stored size: 634 Bytes

Contents

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

require "rubygems"
require "bunny"

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

87 entries across 87 versions & 1 rubygems

Version Path
bunny-2.2.2 examples/guides/extensions/alternate_exchange.rb
bunny-2.2.1 examples/guides/extensions/alternate_exchange.rb
bunny-2.2.0 examples/guides/extensions/alternate_exchange.rb
bunny-1.7.1 examples/guides/extensions/alternate_exchange.rb
bunny-2.1.0 examples/guides/extensions/alternate_exchange.rb
bunny-2.0.1 examples/guides/extensions/alternate_exchange.rb
bunny-2.0.0 examples/guides/extensions/alternate_exchange.rb
bunny-2.0.0.rc2 examples/guides/extensions/alternate_exchange.rb
bunny-2.0.0.rc1 examples/guides/extensions/alternate_exchange.rb
bunny-1.7.0 examples/guides/extensions/alternate_exchange.rb
bunny-1.6.3 examples/guides/extensions/alternate_exchange.rb
bunny-1.6.2 examples/guides/extensions/alternate_exchange.rb
bunny-1.6.1 examples/guides/extensions/alternate_exchange.rb
bunny-1.6.0 examples/guides/extensions/alternate_exchange.rb
bunny-1.5.1 examples/guides/extensions/alternate_exchange.rb
bunny-1.6.0.rc2 examples/guides/extensions/alternate_exchange.rb
bunny-1.6.0.rc1 examples/guides/extensions/alternate_exchange.rb
bunny-1.6.0.pre1 examples/guides/extensions/alternate_exchange.rb
bunny-1.5.0 examples/guides/extensions/alternate_exchange.rb
bunny-1.5.0.pre2 examples/guides/extensions/alternate_exchange.rb