Sha256: 9d3af20cffce5c1cd13f887a9b0f7dac976de52d00ef83f2c4926a4d0f14eee5
Contents?: true
Size: 1.61 KB
Versions: 3
Compression:
Stored size: 1.61 KB
Contents
# -*- encoding: utf-8; mode: ruby -*- require "timeout" require "bunny/version" require "amq/protocol/client" require "bunny/framing" require "bunny/exceptions" require "bunny/socket" begin require "openssl" require "bunny/ssl_socket" rescue LoadError => e # no-op end require "logger" # Core entities: connection, channel, exchange, queue, consumer require "bunny/session" require "bunny/channel" require "bunny/exchange" require "bunny/queue" require "bunny/consumer" module Bunny PROTOCOL_VERSION = AMQ::Protocol::PROTOCOL_VERSION # unifies Ruby standard library's Timeout (which is not accurate on # Ruby 1.8 and has other issues) and SystemTimer (the gem) Timer = if RUBY_VERSION < "1.9" begin require "bunny/system_timer" Bunny::SystemTimer rescue LoadError Timeout end else Timeout end # # API # def self.version VERSION end def self.protocol_version AMQ::Protocol::PROTOCOL_VERSION end def self.new(connection_string_or_opts = {}, opts = {}, &block) if connection_string_or_opts.respond_to?(:keys) && opts.empty? opts = connection_string_or_opts end conn = Session.new(connection_string_or_opts, opts) @default_connection ||= conn conn end def self.run(connection_string_or_opts = {}, opts = {}, &block) raise ArgumentError, 'Bunny#run requires a block' unless block client = Client.new(connection_string_or_opts, opts) begin client.start block.call(client) ensure client.stop end :run_ok end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bunny-0.9.0.pre13 | lib/bunny.rb |
bunny-0.9.0.pre12 | lib/bunny.rb |
bunny-0.9.0.pre11 | lib/bunny.rb |