Class: Smith::QueueFactory
- Inherits:
-
Object
- Object
- Smith::QueueFactory
- Defined in:
- lib/smith/messaging/queue_factory.rb
Instance Method Summary collapse
-
#each_queue ⇒ Object
Passes each queue to the supplied block.
-
#initialize ⇒ QueueFactory
constructor
A new instance of QueueFactory.
-
#queues ⇒ Object
Returns all queues as a hash, with the queue name being the key.
-
#receiver(queue_name, opts = {}, &blk) ⇒ Object
Convenience method that returns a Receiver object.
-
#sender(queue_name, opts = {}, &blk) ⇒ Object
Convenience method that returns a Sender object.
Constructor Details
#initialize ⇒ QueueFactory
Returns a new instance of QueueFactory.
5 6 7 |
# File 'lib/smith/messaging/queue_factory.rb', line 5 def initialize @cache = Cache.new end |
Instance Method Details
#each_queue ⇒ Object
Passes each queue to the supplied block.
20 21 22 23 24 |
# File 'lib/smith/messaging/queue_factory.rb', line 20 def each_queue @cache.each do |queue| yield queue end end |
#queues ⇒ Object
Returns all queues as a hash, with the queue name being the key.
27 28 29 |
# File 'lib/smith/messaging/queue_factory.rb', line 27 def queues @cache end |
#receiver(queue_name, opts = {}, &blk) ⇒ Object
Convenience method that returns a Receiver object.
15 16 17 |
# File 'lib/smith/messaging/queue_factory.rb', line 15 def receiver(queue_name, opts={}, &blk) create(queue_name, :receiver, opts, &blk) end |
#sender(queue_name, opts = {}, &blk) ⇒ Object
Convenience method that returns a Sender object.
10 11 12 |
# File 'lib/smith/messaging/queue_factory.rb', line 10 def sender(queue_name, opts={}, &blk) create(queue_name, :sender, opts, &blk) end |