public void StartReceiveMessage(IReceivedMessageCallback callback) { using (completionQueue.NewScope()) { var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IReceivedMessageCallback, callback); Native.grpcsharp_call_recv_message(this, ctx).CheckOk(); } }
/// <summary> /// /// </summary> /// <typeparam name="TResponse"></typeparam> /// <param name="payload"></param> /// <param name="context"></param> /// <param name="tcs"></param> /// <param name="receivedMessageCallback"></param> public void ClientCall <TResponse>( byte[] payload, SendCallContext <TResponse> context, IReceivedMessageCallback <TResponse> receivedMessageCallback ) where TResponse : class { var task = Task.Factory.StartNew(async() => { await channel.SendAsync(payload); var buffer = await channel.ReceiveAsync(); receivedMessageCallback.OnClientResponse(true, context.Completion, buffer); }); taskQueue.Add(task); }
public void StartReceiveMessage(IReceivedMessageCallback callback) { ReceivedMessageCallback = callback; }