Beispiel #1
0
        public override async Task DispatchAsync(string path, RpcFilterContext context)
        {
            if (_processorManager.ContainsProcessor(path))
            {
                var processor = _processorManager.GetProcessor(path);

                if (processor.Available)
                {
                    try
                    {
                        await processor.Pipeline.First.FiltsAsync(context);

                        await writeResponse(context.RpcContext.Response, context);
                    }
                    catch (Exception ex)
                    {
                        context.Error = ex;

                        _logger?.Error(ex);

                        await processor.ErrorPileline.First.FiltsAsync(context);

                        await writeResponse(context.RpcContext.Response, context);
                    }
                }
                else
                {
                    await writeResponse(RpcResponse.CreateServiceNotAvailableResponse(context.RpcContext.Request.RequestId), context);
                }
            }
            else
            {
                await writeResponse(RpcResponse.CreateServiceNotFoundResponse(context.RpcContext.Request.RequestId), context);
            }
        }