Exemple #1
0
        public AsyncDuplexStreamingCall <TRequest, TResponse> AsyncDuplexStreamingCall(Interceptor.AsyncDuplexStreamingCallContinuation <TRequest, TResponse> continuation)
        {
            var rspCnt = continuation(_context);
            var tracingRequestStream  = new TracingClientStreamWriter <TRequest, TResponse>(rspCnt.RequestStream, _context, _tracer.Request);
            var tracingResponseStream = new TracingAsyncClientStreamReader <TResponse, TRequest>(rspCnt.ResponseStream, _context, _tracer.Response, _tracer.Finish, _tracer.Exception);

            return(new AsyncDuplexStreamingCall <TRequest, TResponse>(tracingRequestStream, tracingResponseStream, rspCnt.ResponseHeadersAsync, rspCnt.GetStatus, rspCnt.GetTrailers, rspCnt.Dispose));
        }
Exemple #2
0
        public AsyncClientStreamingCall <TRequest, TResponse> AsyncClientStreamingCall(Interceptor.AsyncClientStreamingCallContinuation <TRequest, TResponse> continuation)
        {
            var rspCnt = continuation(_context);
            var tracingRequestStream = new TracingClientStreamWriter <TRequest, TResponse>(rspCnt.RequestStream, _context, _tracer.Request);
            var rspAsync             = rspCnt.ResponseAsync.ContinueWith(rspTask =>
            {
                try
                {
                    var response = rspTask.Result;
                    _tracer.Response(response, _context);
                    _tracer.Finish(_context);
                    return(response);
                }
                catch (AggregateException ex)
                {
                    _tracer.Exception(_context, ex.InnerException, null);
                    throw ex.InnerException;
                }
            });

            return(new AsyncClientStreamingCall <TRequest, TResponse>(tracingRequestStream, rspAsync, rspCnt.ResponseHeadersAsync, rspCnt.GetStatus, rspCnt.GetTrailers, rspCnt.Dispose));
        }