/usr/lib/ruby/1.9.1/bunny.rb is in libbunny-ruby1.9.1 0.6.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | $:.unshift File.expand_path(File.dirname(__FILE__))
# Ruby standard libraries
%w[socket thread timeout logger].each do |file|
require file
end
module Bunny
class ConnectionError < StandardError; end
class ForcedChannelCloseError < StandardError; end
class ForcedConnectionCloseError < StandardError; end
class MessageError < StandardError; end
class ProtocolError < StandardError; end
class ServerDownError < StandardError; end
class UnsubscribeError < StandardError; end
class AcknowledgementError < StandardError; end
VERSION = '0.6.0'
# Returns the Bunny version number
def self.version
VERSION
end
# Instantiates new Bunny::Client
def self.new(opts = {})
# Set up Bunny according to AMQP spec version required
spec_version = opts[:spec] || '08'
# Return client
setup(spec_version, opts)
end
# Runs a code block using a short-lived connection
def self.run(opts = {}, &block)
raise ArgumentError, 'Bunny#run requires a block' unless block
# Set up Bunny according to AMQP spec version required
spec_version = opts[:spec] || '08'
client = setup(spec_version, opts)
begin
client.start
block.call(client)
ensure
client.stop
end
# Return success
:run_ok
end
private
def self.setup(version, opts)
if version == '08'
# AMQP 0-8 specification
require 'qrack/qrack08'
require 'bunny/client08'
require 'bunny/exchange08'
require 'bunny/queue08'
require 'bunny/channel08'
require 'bunny/subscription08'
client = Bunny::Client.new(opts)
else
# AMQP 0-9-1 specification
require 'qrack/qrack09'
require 'bunny/client09'
require 'bunny/exchange09'
require 'bunny/queue09'
require 'bunny/channel09'
require 'bunny/subscription09'
client = Bunny::Client09.new(opts)
end
include Qrack
client
end
end
|