Module: Refinery::Queueable
- Includes:
- Configurable, Loggable
- Defined in:
- lib/refinery/queueable.rb
Overview
Mix this module in to classes that want to access a queue.
Instance Method Summary collapse
-
#queue(name) ⇒ Object
Get a named queue.
-
#with_queue(name, &block) ⇒ Object
Given the queue name and a block, yield the named queue into the block.
Methods included from Configurable
Methods included from Loggable
Instance Method Details
#queue(name) ⇒ Object
Get a named queue
7 8 9 |
# File 'lib/refinery/queueable.rb', line 7 def queue(name) queue_provider.queue(name) end |
#with_queue(name, &block) ⇒ Object
Given the queue name and a block, yield the named queue into the block.
13 14 15 16 17 18 19 20 |
# File 'lib/refinery/queueable.rb', line 13 def with_queue(name, &block) begin yield queue(name) rescue Exception => e logger.error "An error occurred when communicating with queue #{name}: #{e.}" sleep(30) end end |