Class: DataCollector::Output::Rpc
- Defined in:
- lib/data_collector/output/rpc.rb
Instance Method Summary collapse
-
#initialize(uri, options = {}) ⇒ Rpc
constructor
A new instance of Rpc.
- #send(message) ⇒ Object
- #stop ⇒ Object
Methods inherited from Generic
Constructor Details
#initialize(uri, options = {}) ⇒ Rpc
Returns a new instance of Rpc.
6 7 8 |
# File 'lib/data_collector/output/rpc.rb', line 6 def initialize(uri, = {}) super end |
Instance Method Details
#send(message) ⇒ Object
10 11 12 13 |
# File 'lib/data_collector/output/rpc.rb', line 10 def send() raise DataCollector::Error, "No client found" if @producer.nil? || stopped? JSON.parse(@producer.publish(, @bunny_queue)) end |
#stop ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/data_collector/output/rpc.rb', line 15 def stop if @producer && @running @running = false @producer.shutdown end rescue Bunny::ConnectionAlreadyClosed => e DataCollector::Core.log(e.) rescue StandardError => e DataCollector::Core.error(e.) end |