Sha256: 96fb1626dedcbbab603df73956130e1e2e51ba36f3f09223d38ccae8a4f60e54

Contents?: true

Size: 590 Bytes

Versions: 12

Compression:

Stored size: 590 Bytes

Contents

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

require "bundler"
Bundler.setup

$:.unshift(File.expand_path("../../../lib", __FILE__))

require 'bunny'

conn = Bunny.new(heartbeat_timeout: 8)
conn.start

begin
  ch2 = conn.create_channel
  q   = "bunny.examples.recovery.q#{rand}"

  ch2.queue_declare(q, :durable => false)
  ch2.queue_declare(q, :durable => true)
rescue Bunny::PreconditionFailed => e
  puts "Channel-level exception! Code: #{e.channel_close.reply_code}, message: #{e.channel_close.reply_text}"
ensure
  conn.create_channel.queue_delete(q)
end

puts "Disconnecting..."
conn.close

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bunny-2.17.0 examples/connection/channel_level_exception.rb
bunny-2.16.1 examples/connection/channel_level_exception.rb
bunny-2.15.0 examples/connection/channel_level_exception.rb
bunny-2.14.4 examples/connection/channel_level_exception.rb
bunny-2.14.3 examples/connection/channel_level_exception.rb
bunny-2.14.2 examples/connection/channel_level_exception.rb
bunny-2.14.1 examples/connection/channel_level_exception.rb
bunny-2.13.0 examples/connection/channel_level_exception.rb
bunny-2.12.1 examples/connection/channel_level_exception.rb
bunny-2.12.0 examples/connection/channel_level_exception.rb
bunny-2.12.0.rc1 examples/connection/channel_level_exception.rb
bunny-2.11.0 examples/connection/channel_level_exception.rb