Module: GorgonBunny

Defined in:
lib/gorgon_bunny/lib/gorgon_bunny.rb,
lib/gorgon_bunny/lib/gorgon_bunny/queue.rb,
lib/gorgon_bunny/lib/gorgon_bunny/socket.rb,
lib/gorgon_bunny/lib/gorgon_bunny/channel.rb,
lib/gorgon_bunny/lib/gorgon_bunny/framing.rb,
lib/gorgon_bunny/lib/gorgon_bunny/session.rb,
lib/gorgon_bunny/lib/gorgon_bunny/timeout.rb,
lib/gorgon_bunny/lib/gorgon_bunny/version.rb,
lib/gorgon_bunny/lib/gorgon_bunny/consumer.rb,
lib/gorgon_bunny/lib/gorgon_bunny/exchange.rb,
lib/gorgon_bunny/lib/gorgon_bunny/test_kit.rb,
lib/gorgon_bunny/lib/gorgon_bunny/transport.rb,
lib/gorgon_bunny/lib/gorgon_bunny/exceptions.rb,
lib/gorgon_bunny/lib/gorgon_bunny/ssl_socket.rb,
lib/gorgon_bunny/lib/gorgon_bunny/reader_loop.rb,
lib/gorgon_bunny/lib/gorgon_bunny/return_info.rb,
lib/gorgon_bunny/lib/gorgon_bunny/system_timer.rb,
lib/gorgon_bunny/lib/gorgon_bunny/compatibility.rb,
lib/gorgon_bunny/lib/gorgon_bunny/delivery_info.rb,
lib/gorgon_bunny/lib/gorgon_bunny/heartbeat_sender.rb,
lib/gorgon_bunny/lib/gorgon_bunny/consumer_work_pool.rb,
lib/gorgon_bunny/lib/gorgon_bunny/message_properties.rb,
lib/gorgon_bunny/lib/gorgon_bunny/channel_id_allocator.rb,
lib/gorgon_bunny/lib/gorgon_bunny/concurrent/condition.rb,
lib/gorgon_bunny/lib/gorgon_bunny/consumer_tag_generator.rb,
lib/gorgon_bunny/lib/gorgon_bunny/versioned_delivery_tag.rb,
lib/gorgon_bunny/lib/gorgon_bunny/concurrent/atomic_fixnum.rb,
lib/gorgon_bunny/lib/gorgon_bunny/concurrent/continuation_queue.rb,
lib/gorgon_bunny/lib/gorgon_bunny/authentication/credentials_encoder.rb,
lib/gorgon_bunny/lib/gorgon_bunny/concurrent/synchronized_sorted_set.rb,
lib/gorgon_bunny/lib/gorgon_bunny/concurrent/linked_continuation_queue.rb,
lib/gorgon_bunny/lib/gorgon_bunny/authentication/plain_mechanism_encoder.rb,
lib/gorgon_bunny/lib/gorgon_bunny/authentication/external_mechanism_encoder.rb

Overview

GorgonBunny is a RabbitMQ client that focuses on ease of use.

Defined Under Namespace

Modules: Authentication, Compatibility, Concurrent, Framing Classes: AccessRefused, AuthenticationFailureError, BadLengthError, Channel, ChannelAlreadyClosed, ChannelError, ChannelIdAllocator, ChannelLevelException, ClientTimeout, CommandInvalid, ConnectionClosedError, ConnectionForced, ConnectionLevelException, ConnectionTimeout, Consumer, ConsumerTagGenerator, ConsumerWorkPool, DeliveryInfo, Exception, Exchange, ForcedChannelCloseError, ForcedConnectionCloseError, FrameError, HeartbeatSender, InconsistentDataError, InternalError, MessageError, MessageProperties, MissingTLSCertificateFile, MissingTLSKeyFile, NetworkErrorWrapper, NetworkFailure, NoFinalOctetError, NotFound, PossibleAuthenticationFailureError, PreconditionFailed, ProtocolError, Queue, ReaderLoop, ResourceError, ResourceLocked, ReturnInfo, Session, ShutdownSignal, Socket, SystemTimer, TCPConnectionFailed, TestKit, Transport, UnexpectedFrame, VersionedDeliveryTag

Constant Summary collapse

PROTOCOL_VERSION =

AMQP protocol version GorgonBunny implements

GorgonAMQ::Protocol::PROTOCOL_VERSION
Client =

backwards compatibility

Session
Timeout =

Unifies Ruby standard library’s Timeout (which is not accurate on Ruby 1.8) and SystemTimer (the gem)

if RUBY_VERSION < "1.9"
  begin
    require "gorgon_bunny/system_timer"
    GorgonBunny::SystemTimer
  rescue LoadError
    Timeout
  end
else
  Timeout
end
Timer =

Backwards compatibility

Timeout
VERSION =

Returns Version of the library.

Returns:

  • (String)

    Version of the library

"1.0.0"
ConnectionError =

backwards compatibility

TCPConnectionFailed
ServerDownError =
TCPConnectionFailed

Class Method Summary collapse

Class Method Details

.new(connection_string_or_opts = {}, opts = {}, &block) ⇒ GorgonBunny::Session

Instantiates a new connection. The actual connection network connection is started with GorgonBunny::Session#start



62
63
64
65
66
67
68
69
70
71
# File 'lib/gorgon_bunny/lib/gorgon_bunny.rb', line 62

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_versionString

Returns AMQP protocol version GorgonBunny implements.

Returns:

  • (String)

    AMQP protocol version GorgonBunny implements



50
51
52
# File 'lib/gorgon_bunny/lib/gorgon_bunny.rb', line 50

def self.protocol_version
  GorgonAMQ::Protocol::PROTOCOL_VERSION
end

.run(connection_string_or_opts = {}, opts = {}, &block) ⇒ Object

Raises:

  • (ArgumentError)


74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/gorgon_bunny/lib/gorgon_bunny.rb', line 74

def self.run(connection_string_or_opts = {}, opts = {}, &block)
  raise ArgumentError, 'GorgonBunny#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

.versionString

Returns GorgonBunny version.

Returns:

  • (String)

    GorgonBunny version



45
46
47
# File 'lib/gorgon_bunny/lib/gorgon_bunny.rb', line 45

def self.version
  VERSION
end