module Bunny
Bunny
is a RabbitMQ client that focuses on ease of use. @see rubybunny.info
Constants
- Client
Represents AMQP 0.9.1 connection (to a RabbitMQ node). @see rubybunny.info/articles/connecting.html Connecting to RabbitMQ guide
- ConnectionError
Raised when TCP connection to RabbitMQ fails because of an unresolved hostname, connectivity problem, etc
- PROTOCOL_VERSION
AMQP protocol version
Bunny
implements- SSLSocketImpl
TLS-enabled TCP socket that implements convenience methods found in
Bunny::Socket
.- ServerDownError
Raised when TCP connection to RabbitMQ fails because of an unresolved hostname, connectivity problem, etc
- SocketImpl
TCP socket extension that uses TCP_NODELAY and supports reading fully.
Heavily inspired by Dalli by Mike Perham. @private
- Timeout
- Timer
Backwards compatibility @private
- VERSION
@return [String] Version of the library
Public Class Methods
Instantiates a new connection. The actual 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 60 def self.new(connection_string_or_opts = ENV['RABBITMQ_URL'], opts = {}) 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
@return [String] AMQP protocol version Bunny
implements
# File lib/bunny.rb, line 48 def self.protocol_version AMQ::Protocol::PROTOCOL_VERSION end
# File lib/bunny.rb, line 72 def self.run(connection_string_or_opts = ENV['RABBITMQ_URL'], opts = {}, &block) raise ArgumentError, 'Bunny#run requires a block' unless block if connection_string_or_opts.respond_to?(:keys) && opts.empty? opts = connection_string_or_opts end client = Session.new(connection_string_or_opts, opts) begin client.start block.call(client) ensure client.stop end # backwards compatibility :run_ok end
@return [String] Bunny
version
# File lib/bunny.rb, line 43 def self.version VERSION end