Class: GrpcKit::Rpcs::Client::RequestResponse

Inherits:
GrpcKit::Rpcs::ClientRpc show all
Defined in:
lib/grpc_kit/rpcs/client_request_response.rb

Instance Attribute Summary

Attributes inherited from GrpcKit::Rpcs::ClientRpc

#config

Instance Method Summary collapse

Methods inherited from GrpcKit::Rpcs::ClientRpc

#initialize

Constructor Details

This class inherits a constructor from GrpcKit::Rpcs::ClientRpc

Instance Method Details

#invoke(stream, request, metadata: {}, timeout: nil) ⇒ Object

Returns response message.

Parameters:

Returns:

  • (Object)

    response message



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/grpc_kit/rpcs/client_request_response.rb', line 14

def invoke(stream, request, metadata: {}, timeout: nil)
  call = GrpcKit::Calls::Client::RequestResponse.new(
    metadata: ,
    config: @config,
    timeout: timeout,
    stream: stream,
  )

  Timeout.timeout(timeout&.to_f, GrpcKit::Errors::DeadlineExceeded) do
    if @config.interceptor
      @config.interceptor.intercept(request, call, call.) do
        call.send_msg(request)
        call.recv
      end
    else
      call.send_msg(request)
      call.recv
    end
  end
end