Class AMQP::Consumer
In: lib/amqp/consumer.rb
Parent: AMQ::Client::Async::Consumer

AMQP consumers are entities that handle messages delivered to them ("push API" as opposed to "pull API") by AMQP broker. Every consumer is associated with a queue. Consumers can be exclusive (no other consumers can be registered for the same queue) or not (consumers share the queue). In the case of multiple consumers per queue, messages are distributed in round robin manner with respect to channel-level prefetch setting).

@see AMQP::Queue @see AMQP::Queue#subscribe @see AMQP::Queue#cancel

Methods

Attributes

arguments  [R]  @return [Hash] Custom subscription metadata
channel  [R]  @return [AMQP::Channel] Channel this consumer uses
consumer_tag  [R]  @return [String] Consumer tag, unique consumer identifier
queue  [R]  @return [AMQP::Queue] Queue messages are consumed from

Public Class methods

@return [AMQ::Client::ConsumerTagGenerator] Consumer tag generator

@param [AMQ::Client::ConsumerTagGenerator] Assigns consumer tag generator that will be used by consumer instances @return [AMQ::Client::ConsumerTagGenerator] Provided argument

Public Instance methods

Acknowledge a delivery tag. @return [Consumer] self

@api public @see bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.8.3.13.)

after_connection_interruption(&block)
after_recovery(&block)

Alias for on_recovery

Called by associated connection object when AMQP connection has been re-established (for example, after a network failure).

@api plugin

Defines a callback that will be executed after TCP connection is 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

Legacy {AMQP::Queue} API compatibility. @private @deprecated

Begin consuming messages from the queue @return [AMQP::Consumer] self

@return [Boolean] true if this consumer is exclusive (other consumers for the same queue are not allowed)

@return [String] Readable representation of relevant object state.

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

Register a block that will be used to handle delivered messages.

@return [AMQP::Consumer] self @see AMQP::Queue#subscribe

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

@api public

@return [Consumer] self

@api public @see bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.8.3.14.)

Used by automatic recovery code. @api plugin @return [AMQP::Consumer] self

{AMQP::Queue} API compatibility.

@return [Boolean] true if this consumer is active (subscribed for message delivery) @api public

[Validate]