Exemple #1
0
        public async Task Send(T context, IPipe <T> next)
        {
            var consumerMetrics = new ConsumerMetrics(context, _parseMessageType);

            consumerMetrics.CountMessage();
            try
            {
                await consumerMetrics.Measure(() => next.Send(context)).ConfigureAwait(false);

                consumerMetrics.MeasureCriticalTime();
            }
            catch (Exception)
            {
                consumerMetrics.CountError();
                throw;
            }
        }
        public async Task Send(T context, IPipe <T> next)
        {
            var consumerMetrics = new ConsumerMetrics(context);

            consumerMetrics.CountMessage();
            try
            {
                using (consumerMetrics.ConsumeTimer())
                {
                    await next.Send(context).ConfigureAwait(false);
                }

                consumerMetrics.MeasureCriticalTime();
            }
            catch (Exception)
            {
                consumerMetrics.CountError();
                throw;
            }
        }