public async Task DivMany(ServerCallContext context, IAsyncStreamReader<DivArgs> requestStream, IServerStreamWriter<DivReply> responseStream) { await requestStream.ForEach(async divArgs => { await responseStream.WriteAsync(DivInternal(divArgs)); }); }
public async Task DivMany(ServerCallContext context, IAsyncStreamReader <DivArgs> requestStream, IServerStreamWriter <DivReply> responseStream) { await requestStream.ForEach(async divArgs => { await responseStream.Write(DivInternal(divArgs)); }); }
public async Task<Num> Sum(ServerCallContext context, IAsyncStreamReader<Num> requestStream) { long sum = 0; await requestStream.ForEach(async num => { sum += num.Num_; }); return Num.CreateBuilder().SetNum_(sum).Build(); }
public async Task<StreamingInputCallResponse> StreamingInputCall(ServerCallContext context, IAsyncStreamReader<StreamingInputCallRequest> requestStream) { int sum = 0; await requestStream.ForEach(async request => { sum += request.Payload.Body.Length; }); return StreamingInputCallResponse.CreateBuilder().SetAggregatedPayloadSize(sum).Build(); }
public async Task <StreamingInputCallResponse> StreamingInputCall(ServerCallContext context, IAsyncStreamReader <StreamingInputCallRequest> requestStream) { int sum = 0; await requestStream.ForEach(async request => { sum += request.Payload.Body.Length; }); return(StreamingInputCallResponse.CreateBuilder().SetAggregatedPayloadSize(sum).Build()); }
public async Task <Num> Sum(ServerCallContext context, IAsyncStreamReader <Num> requestStream) { long sum = 0; await requestStream.ForEach(async num => { sum += num.Num_; }); return(Num.CreateBuilder().SetNum_(sum).Build()); }
public async Task FullDuplexCall(ServerCallContext context, IAsyncStreamReader <StreamingOutputCallRequest> requestStream, IServerStreamWriter <StreamingOutputCallResponse> responseStream) { await requestStream.ForEach(async request => { foreach (var responseParam in request.ResponseParametersList) { var response = StreamingOutputCallResponse.CreateBuilder() .SetPayload(CreateZerosPayload(responseParam.Size)).Build(); await responseStream.Write(response); } }); }
private static async Task <string> ConcatAndEchoHandler(ServerCallContext context, IAsyncStreamReader <string> requestStream) { string result = ""; await requestStream.ForEach(async (request) => { if (request == "THROW") { throw new Exception("This was thrown on purpose by a test"); } result += request; }); // simulate processing takes some time. await Task.Delay(250); return(result); }
private static async Task<string> ConcatAndEchoHandler(IAsyncStreamReader<string> requestStream, ServerCallContext context) { string result = ""; await requestStream.ForEach(async (request) => { if (request == "THROW") { throw new Exception("This was thrown on purpose by a test"); } result += request; }); // simulate processing takes some time. await Task.Delay(250); return result; }
public async Task FullDuplexCall(ServerCallContext context, IAsyncStreamReader<StreamingOutputCallRequest> requestStream, IServerStreamWriter<StreamingOutputCallResponse> responseStream) { await requestStream.ForEach(async request => { foreach (var responseParam in request.ResponseParametersList) { var response = StreamingOutputCallResponse.CreateBuilder() .SetPayload(CreateZerosPayload(responseParam.Size)).Build(); await responseStream.WriteAsync(response); } }); }