예제 #1
0
        public override async Task InvokeAsync(IPipeContext context, CancellationToken token)
        {
            try
            {
                await InnerPipe.InvokeAsync(context, token);

                await Next.InvokeAsync(context, token);
            }
            catch (Exception e)
            {
                _logger.Error(e, "Exception thrown. Will be handled by Exception Handler");
                await OnExceptionAsync(e, context, token);
            }
        }
예제 #2
0
        protected virtual async Task InvokeConsumePipeAsync(IPipeContext context, BasicDeliverEventArgs args, CancellationToken token)
        {
            _logger.Debug("Invoking consumer pipe for message {messageId}", args?.BasicProperties?.MessageId);
            var consumeContext = ContextFactory.CreateContext(context.Properties.ToArray());

            consumeContext.Properties.Add(PipeKey.DeliveryEventArgs, args);
            try
            {
                await ConsumePipe.InvokeAsync(consumeContext, token);
            }
            catch (Exception e)
            {
                _logger.Error(e, "An unhandled exception was thrown when consuming message with routing key {routingKey}", args.RoutingKey);
                throw;
            }
        }