Example #1
0
 public void StartReceiveMessage(IReceivedMessageCallback callback)
 {
     using (completionQueue.NewScope())
     {
         var ctx = completionQueue.CompletionRegistry.RegisterBatchCompletion(CompletionHandler_IReceivedMessageCallback, callback);
         Native.grpcsharp_call_recv_message(this, ctx).CheckOk();
     }
 }
Example #2
0
        /// <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);
        }
Example #3
0
 public void StartReceiveMessage(IReceivedMessageCallback callback)
 {
     ReceivedMessageCallback = callback;
 }