Class: FreeMessageQueue::ForwardQueue
- Defined in:
- lib/fmq/queues/forward.rb
Overview
This queue returns sends one message to several queues at a time.
queue_manager = FreeMessageQueue::QueueManager.new(true) do
setup_queue "/fmq_test/forward_to_1_and_2", FreeMessageQueue::ForwardQueue do |q|
q.forward_to = ["/fmq_test/test1", "/fmq_test/test2"]
end
end
NOTE the poll method is not implemented in this queue. It is a put only queue.
Constant Summary
Constants inherited from BaseQueue
Instance Attribute Summary
Attributes inherited from BaseQueue
#bytes, #manager, #max_messages, #max_size, #size
Instance Method Summary collapse
-
#forward_to=(urls) ⇒ Object
CONFIGURATION *OPTION you can add as may queues as you want but seperate them with a space char.
-
#initialize(manager) ⇒ ForwardQueue
constructor
A new instance of ForwardQueue.
-
#put(message) ⇒ Object
put the message from this queue to the queues that are specified in the forward-to configuration option.
Methods inherited from BaseQueue
Constructor Details
#initialize(manager) ⇒ ForwardQueue
Returns a new instance of ForwardQueue.
33 34 35 36 |
# File 'lib/fmq/queues/forward.rb', line 33 def initialize(manager) super(manager) @forwards = [] end |
Instance Method Details
#forward_to=(urls) ⇒ Object
CONFIGURATION *OPTION you can add as may queues as you want but seperate them with a space char
49 50 51 |
# File 'lib/fmq/queues/forward.rb', line 49 def forward_to=(urls) @forwards = urls end |
#put(message) ⇒ Object
put the message from this queue to the queues that are specified in the forward-to configuration option.
40 41 42 43 44 |
# File 'lib/fmq/queues/forward.rb', line 40 def put() for forward in @forwards do @manager.put(forward, .clone) end end |