Sha256: 88f83f7a8a8eade0cd59d533cd5c5c939fb75b0bde0b6ae7ee04b3877562982e

Contents?: true

Size: 660 Bytes

Versions: 92

Compression:

Stored size: 660 Bytes

Contents

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

require "rubygems"
require "bunny"

puts "=> Demonstrating connection.blocked"
puts

conn = Bunny.new
conn.start

ch   = conn.create_channel
x    = ch.fanout("amq.fanout")

# This example requires high memory watermark to be set
# really low to demonstrate blocking.
#
# rabbitmqctl set_vm_memory_high_watermark 0.00000001
#
# should do it.

conn.on_blocked do |connection_blocked|
  puts "Connection is blocked. Reason: #{connection_blocked.reason}"
end

conn.on_unblocked do |connection_unblocked|
  puts "Connection is unblocked."
end

x.publish("z" * 1024 * 1024 * 16)

sleep 120.0
puts "Disconnecting..."
conn.close

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
bunny-1.1.0.pre1 examples/guides/extensions/connection_blocked.rb
bunny-1.0.4 examples/guides/extensions/connection_blocked.rb
bunny-1.0.3 examples/guides/extensions/connection_blocked.rb
bunny-1.0.2 examples/guides/extensions/connection_blocked.rb
bunny-1.0.1 examples/guides/extensions/connection_blocked.rb
bunny-1.0.0 examples/guides/extensions/connection_blocked.rb
bunny-1.0.0.rc3 examples/guides/extensions/connection_blocked.rb
bunny-1.0.0.rc2 examples/guides/extensions/connection_blocked.rb
bunny-1.0.0.rc1 examples/guides/extensions/connection_blocked.rb
bunny-1.0.0.pre6 examples/guides/extensions/connection_blocked.rb
bunny-1.0.0.pre5 examples/guides/extensions/connection_blocked.rb
bunny-1.0.0.pre4 examples/guides/extensions/connection_blocked.rb