Namespace

Class/Module Index [+]

Quicksearch

Bunny

Bunny is a RabbitMQ client that focuses on ease of use. @see rubybunny.info

Constants

Client

backwards compatibility

ConnectionError

backwards compatibility @private

PROTOCOL_VERSION

AMQP protocol version Bunny implements

ServerDownError

@private

Timer

unifies Ruby standard library's Timeout (which is not accurate on Ruby 1.8 and has other issues) and SystemTimer (the gem)

VERSION

@return [String] Version of the library

Public Class Methods

new(connection_string_or_opts = {}, opts = {}, &block) click to toggle source

Instantiates a new connection. The actual connection network connection is started with {Bunny::Session#start}

@return [Bunny::Session] @see Bunny::Session#start @see rubybunny.info/articles/getting_started.html @see rubybunny.info/articles/connecting.html @api public

# File lib/bunny.rb, line 70
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
protocol_version() click to toggle source

@return [String] AMQP protocol version Bunny implements

# File lib/bunny.rb, line 58
def self.protocol_version
  AMQ::Protocol::PROTOCOL_VERSION
end
run(connection_string_or_opts = {}, opts = {}, &block) click to toggle source
# File lib/bunny.rb, line 82
def self.run(connection_string_or_opts = {}, opts = {}, &block)
  raise ArgumentError, 'Bunny#run requires a block' unless block

  client = Session.new(connection_string_or_opts, opts)

  begin
    client.start
    block.call(client)
  ensure
    client.stop
  end

  # backwards compatibility
  :run_ok
end
version() click to toggle source

@return [String] Bunny version

# File lib/bunny.rb, line 53
def self.version
  VERSION
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.