Class: DataCollector::Input::Queue
- Defined in:
- lib/data_collector/input/queue.rb
Instance Method Summary collapse
-
#initialize(uri, options = {}) ⇒ Queue
constructor
A new instance of Queue.
- #running? ⇒ Boolean
- #send(route, message) ⇒ Object
Methods inherited from Generic
#on_message, #pause, #paused?, #run, #stop, #stopped?
Constructor Details
#initialize(uri, options = {}) ⇒ Queue
Returns a new instance of Queue.
9 10 11 12 13 14 15 |
# File 'lib/data_collector/input/queue.rb', line 9 def initialize(uri, = {}) super if running? create_queue unless @queue end end |
Instance Method Details
#running? ⇒ Boolean
17 18 19 |
# File 'lib/data_collector/input/queue.rb', line 17 def running? @listener.open? end |
#send(route, message) ⇒ Object
21 22 23 24 25 |
# File 'lib/data_collector/input/queue.rb', line 21 def send(route, ) if running? @exchange.publish(, routing_key: route) end end |