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-2.17.0 examples/guides/extensions/connection_blocked.rb
bunny-2.16.1 examples/guides/extensions/connection_blocked.rb
bunny-2.15.0 examples/guides/extensions/connection_blocked.rb
bunny-2.14.4 examples/guides/extensions/connection_blocked.rb
bunny-2.14.3 examples/guides/extensions/connection_blocked.rb
bunny-2.14.2 examples/guides/extensions/connection_blocked.rb
bunny-2.14.1 examples/guides/extensions/connection_blocked.rb
bunny-2.13.0 examples/guides/extensions/connection_blocked.rb
bunny-2.12.1 examples/guides/extensions/connection_blocked.rb
bunny-2.12.0 examples/guides/extensions/connection_blocked.rb
bunny-2.12.0.rc1 examples/guides/extensions/connection_blocked.rb
bunny-2.11.0 examples/guides/extensions/connection_blocked.rb
bunny-2.11.0.pre1 examples/guides/extensions/connection_blocked.rb
bunny-2.10.0 examples/guides/extensions/connection_blocked.rb
bunny-2.9.2 examples/guides/extensions/connection_blocked.rb
bunny-2.9.1 examples/guides/extensions/connection_blocked.rb
bunny-2.6.7 examples/guides/extensions/connection_blocked.rb
bunny-2.7.4 examples/guides/extensions/connection_blocked.rb
bunny-2.8.1 examples/guides/extensions/connection_blocked.rb
bunny-2.9.0 examples/guides/extensions/connection_blocked.rb