Class: Smith::QueueFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/smith/messaging/queue_factory.rb

Instance Method Summary collapse

Constructor Details

#initializeQueueFactory

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_queueObject

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

#queuesObject

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