Module AMQ::Client::Async::Adapter
In: lib/amq/client/async/adapter.rb

Base adapter class. Specific implementations (for example, EventMachine-based, Cool.io-based or sockets-based) subclass it and must implement Adapter API methods:

@abstract

Methods

Included Modules

Openable Callbacks

Classes and Modules

Module AMQ::Client::Async::Adapter::ClassMethods

Public Class methods

Public Instance methods

after_connection_interruption(&block)
after_recovery(&block)

Alias for on_recovery

Performs recovery of channels that are in the automatic recovery mode. Does not run recovery callbacks.

@see Channel#auto_recover @see Queue#auto_recover @see Exchange#auto_recover @api plugin

@return [Boolean] whether connection is in the automatic recovery mode @api public

auto_recovery?()

Alias for auto_recovering?

Defines a callback that will be executed after TCP connection has recovered after a network failure but before AMQP connection is re-opened. Only one callback can be defined (the one defined last replaces previously added ones).

@api public

@api plugin @see disconnect @note Adapters must implement this method but it is NOT supposed to be used directly.

      AMQ protocol defines two-step process of closing connection (send Connection.Close
      to the peer and wait for Connection.Close-Ok), implemented by {Adapter#disconnect}

Properly close connection with AMQ broker, as described in section 2.2.4 of the {bit.ly/hw2ELX AMQP 0.9.1 specification}.

@api plugin @see close_connection

Establish socket connection to the server.

@api plugin

Handles connection.close. When broker detects a connection level exception, this method is called.

@api plugin @see bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.5.2.9)

Handles Connection.Close-Ok.

@api plugin @see bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.10)

Handles Connection.Open-Ok.

@api plugin @see bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.8.)

Handles connection.start.

@api plugin @see bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.)

Handles Connection.Tune-Ok.

@api plugin @see bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.6)

Sends connection preamble to the broker. @api plugin

Returns heartbeat interval this client uses, in seconds. This value may or may not be used depending on broker capabilities. Zero means the server does not want a heartbeat.

@return [Fixnum] Heartbeat interval this client uses, in seconds. @see bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.6)

Defines a callback that will be executed after TCP connection is interrupted (typically because of a network failure). Only one callback can be defined (the one defined last replaces previously added ones).

@api public

Defines a callback that will be executed when connection is closed after connection-level exception. Only one callback can be defined (the one defined last replaces previously added ones).

@api public

Defines a callback that will be run when TCP connection is closed before authentication finishes. Usually this means authentication failure. You can define only one callback.

@api public

Defines a callback that will be executed after AMQP connection has recovered after a network failure.. Only one callback can be defined (the one defined last replaces previously added ones).

@api public

Defines a callback that will be executed after time since last broker heartbeat is greater than or equal to the heartbeat interval (skipped heartbeat is detected). Only one callback can be defined (the one defined last replaces previously added ones).

@api public

Defines a callback that will be run when initial TCP connection fails. You can define only one callback.

@api public

Defines a callback that will be run when TCP connection to AMQP broker is lost (interrupted). You can define only one callback.

@api public

Sends connection.open to the server.

@api plugin @see bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.7)

Processes a single frame.

@param [AMQ::Protocol::Frame] frame @api plugin

Processes a frameset by finding and invoking a suitable handler. Heartbeat frames are treated in a special way: they simply update @last_server_heartbeat value.

@param [Array<AMQ::Protocol::Frame>] frames @api plugin

@return [Boolean]

Resets connection state.

@api plugin

Sends frame to the peer, checking that connection is open.

@raise [ConnectionClosedError]

Sends multiple frames, one by one. For thread safety this method takes a channel object and synchronizes on it.

@api public

Sends a heartbeat frame if connection is open. @api plugin

Sends AMQ protocol header (also known as preamble).

@note This must be implemented by all AMQP clients. @api plugin @see bit.ly/hw2ELX AMQP 0.9.1 specification (Section 2.2)

Sends opaque data to AMQ broker over active connection.

@note This must be implemented by all AMQP clients. @api plugin

Performs recovery of channels that are in the automatic recovery mode. "before recovery" callbacks are run immediately, "after recovery" callbacks are run after AMQP connection is re-established and auto recovery is performed (using auto_recover).

Use this method if you want to run automatic recovery process after handling a connection-level exception, for example, 320 CONNECTION_FORCED (used by RabbitMQ when it is shut down gracefully).

@see Channel#auto_recover @see Queue#auto_recover @see Exchange#auto_recover @api plugin

Called when initial TCP connection fails. @api public

Called when previously established TCP connection fails. @api public

vhost this connection uses. Default is "/", a historically estabilished convention of RabbitMQ and amqp gem.

@return [String] vhost this connection uses @api public

Protected Instance methods

Determines, whether given frame array contains full content body

Determines, whether the received frameset is ready to be further processed

Returns next frame from buffer whenever possible

@api private

[Validate]