Class: NNQ::REQ0

Inherits:
Socket show all
Defined in:
lib/nnq/req_rep.rb

Overview

REQ (nng req0): client side of request/reply. Single in-flight request per socket. #send_request blocks until the matching reply comes back.

Instance Attribute Summary

Attributes inherited from Socket

#options

Instance Method Summary collapse

Methods inherited from Socket

#all_peers_gone, bind, #bind, #close, #close_read, connect, #connect, #connection_count, #frozen_binary, #initialize, #last_endpoint, #monitor, #peer_connected, #raw?, #reconnect_enabled, #reconnect_enabled=

Constructor Details

This class inherits a constructor from NNQ::Socket

Instance Method Details

#send_request(body) ⇒ Object

Sends body as a request, blocks until the matching reply arrives. Returns the reply body (without the id header).



15
16
17
18
# File 'lib/nnq/req_rep.rb', line 15

def send_request(body)
  body = frozen_binary(body)
  Reactor.run { @engine.routing.send_request(body) }
end