Class: RosettaQueue::BaseManager

Inherits:
Object
  • Object
show all
Defined in:
lib/rosetta_queue/consumer_managers/base.rb

Direct Known Subclasses

EventedManager, ThreadedManager

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBaseManager

Returns a new instance of BaseManager.



14
15
16
# File 'lib/rosetta_queue/consumer_managers/base.rb', line 14

def initialize
  @consumers  = {}
end

Instance Attribute Details

#consumersObject (readonly)

Returns the value of attribute consumers.



4
5
6
# File 'lib/rosetta_queue/consumer_managers/base.rb', line 4

def consumers
  @consumers
end

Class Method Details

.create {|manager| ... } ⇒ Object

Yields:

  • (manager)


7
8
9
10
11
# File 'lib/rosetta_queue/consumer_managers/base.rb', line 7

def create
  manager = self.new
  yield manager
  manager
end

Instance Method Details

#add(message_handler, key = message_handler.class.to_s.underscore.to_sym) ⇒ Object



18
19
20
# File 'lib/rosetta_queue/consumer_managers/base.rb', line 18

def add(message_handler, key = message_handler.class.to_s.underscore.to_sym)
  @consumers[key] = Consumer.new(message_handler)
end