Sha256: 1f4434508af2467de11c45623e677a33242f2fcfdd0592137ceb02caea285119

Contents?: true

Size: 829 Bytes

Versions: 86

Compression:

Stored size: 829 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_interval => 8)
conn.start

begin
  ch1 = conn.create_channel
  ch1.queue_delete("queue_that_should_not_exist#{rand}")
rescue Bunny::NotFound => e
  puts "Channel-level exception! Code: #{e.channel_close.reply_code}, message: #{e.channel_close.reply_text}"
end


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

86 entries across 86 versions & 1 rubygems

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