Method: Bunny::Queue#subscribe_with

Defined in:
lib/bunny/queue.rb

#subscribe_with(consumer, opts = {:block => false}) ⇒ Object

Adds a consumer object to the queue (subscribes for message deliveries).

Parameters:

  • consumer (Bunny::Consumer)

    a Consumer subclass that implements consumer interface

  • opts (Hash) (defaults to: {:block => false})

    Options

Options Hash (opts):

  • block (Boolean) — default: false

    Should the call block calling thread?

See Also:



250
251
252
253
254
255
# File 'lib/bunny/queue.rb', line 250

def subscribe_with(consumer, opts = {:block => false})
  @channel.basic_consume_with(consumer)

  @channel.work_pool.join if opts[:block]
  consumer
end