Class: Liebre::Adapter::Bunny::Queue
- Inherits:
-
Object
- Object
- Liebre::Adapter::Bunny::Queue
- Includes:
- Interface::Queue
- Defined in:
- lib/liebre/adapter/bunny/queue.rb
Instance Attribute Summary collapse
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
Instance Method Summary collapse
- #ack(info, opts = {}) ⇒ Object
- #bind(exchange, opts = {}) ⇒ Object
- #get(opts = {}, &block) ⇒ Object
-
#initialize(queue) ⇒ Queue
constructor
A new instance of Queue.
- #nack(info, opts = {}) ⇒ Object
- #name ⇒ Object
- #reject(info, opts = {}) ⇒ Object
- #subscribe(opts = {}, &block) ⇒ Object
Constructor Details
#initialize(queue) ⇒ Queue
Returns a new instance of Queue.
9 10 11 |
# File 'lib/liebre/adapter/bunny/queue.rb', line 9 def initialize queue @queue = queue end |
Instance Attribute Details
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
7 8 9 |
# File 'lib/liebre/adapter/bunny/queue.rb', line 7 def queue @queue end |
Instance Method Details
#ack(info, opts = {}) ⇒ Object
23 24 25 26 27 |
# File 'lib/liebre/adapter/bunny/queue.rb', line 23 def ack info, opts = {} multiple = opts.fetch(:multiple, false) channel.ack(info.delivery_tag, multiple) end |
#bind(exchange, opts = {}) ⇒ Object
17 18 19 20 21 |
# File 'lib/liebre/adapter/bunny/queue.rb', line 17 def bind exchange, opts = {} bunny_exchange = exchange.exchange queue.bind(bunny_exchange, opts) end |
#get(opts = {}, &block) ⇒ Object
42 43 44 |
# File 'lib/liebre/adapter/bunny/queue.rb', line 42 def get opts = {}, &block queue.get(opts, &block) end |
#nack(info, opts = {}) ⇒ Object
29 30 31 32 33 34 |
# File 'lib/liebre/adapter/bunny/queue.rb', line 29 def nack info, opts = {} multiple = opts.fetch(:multiple, false) requeue = opts.fetch(:requeue, false) channel.nack(info.delivery_tag, multiple, requeue) end |
#name ⇒ Object
13 14 15 |
# File 'lib/liebre/adapter/bunny/queue.rb', line 13 def name queue.name end |
#reject(info, opts = {}) ⇒ Object
36 37 38 39 40 |
# File 'lib/liebre/adapter/bunny/queue.rb', line 36 def reject info, opts = {} requeue = opts.fetch(:requeue, false) channel.reject(info.delivery_tag, requeue) end |
#subscribe(opts = {}, &block) ⇒ Object
46 47 48 |
# File 'lib/liebre/adapter/bunny/queue.rb', line 46 def subscribe opts = {}, &block queue.subscribe(opts, &block) end |