Class: LogjamAgent::Receiver
- Inherits:
-
Object
- Object
- LogjamAgent::Receiver
- Defined in:
- lib/logjam_agent/receiver.rb
Instance Method Summary collapse
-
#initialize ⇒ Receiver
constructor
A new instance of Receiver.
- #receive ⇒ Object
Constructor Details
#initialize ⇒ Receiver
Returns a new instance of Receiver.
3 4 5 6 7 8 9 10 |
# File 'lib/logjam_agent/receiver.rb', line 3 def initialize @socket = ZMQForwarder.context.socket(ZMQ::ROUTER) @socket.setsockopt(ZMQ::RCVTIMEO, 100) if @socket.bind("inproc://app") < 0 raise "ZMQ error on binding: #{ZMQ::Util.error_string}" end at_exit { @socket.close } end |
Instance Method Details
#receive ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/logjam_agent/receiver.rb', line 12 def receive answer_parts = [] if @socket.recv_strings(answer_parts) < 0 raise "ZMQ error on receiving: #{ZMQ::Util.error_string}" end answer_parts.shift answer_parts[2] = JSON.parse(answer_parts[2]) answer_parts end |