class FullDuplexEnumerator
A FullDuplexEnumerator passes requests to a block and yields generated responses
Public Class Methods
new(requests)
click to toggle source
# File src/ruby/pb/test/server.rb, line 143 def initialize(requests) @requests = requests end
Public Instance Methods
each_item() { |cls(payload: payload(type: response_type, body: nulls(resp_size)))| ... }
click to toggle source
# File src/ruby/pb/test/server.rb, line 146 def each_item return enum_for(:each_item) unless block_given? GRPC.logger.info('interop-server: started receiving') begin cls = StreamingOutputCallResponse @requests.each do |req| maybe_echo_status_and_message(req) req.response_parameters.each do |params| resp_size = params.size GRPC.logger.info("read a req, response size is #{resp_size}") yield cls.new(payload: Payload.new(type: req.response_type, body: nulls(resp_size))) end end GRPC.logger.info('interop-server: finished receiving') rescue StandardError => e GRPC.logger.info('interop-server: failed') GRPC.logger.warn(e) fail e end end