Exemple #1
0
        void UpdateCounters(DateTime timeSent, DateTime processingStarted, DateTime processingEnded)
        {
            if (CriticalTimeCounter != null)
            {
                CriticalTimeCounter.Update(timeSent, processingStarted, processingEnded);
            }


            if (EstimatedTimeToSLABreachCalculator != null)
            {
                EstimatedTimeToSLABreachCalculator.Update(timeSent, processingStarted, processingEnded);
            }
        }
Exemple #2
0
        /// <summary>
        /// <see cref="Feature.Setup" />.
        /// </summary>
        protected internal override void Setup(FeatureConfigurationContext context)
        {
            var counterInstanceName = context.Settings.EndpointName();
            var criticalTimeCounter = new CriticalTimeCounter(counterInstanceName);

            var notifications = context.Settings.Get <NotificationSubscriptions>();

            notifications.Subscribe <ReceivePipelineCompleted>(e =>
            {
                string timeSentString;

                if (!e.ProcessedMessage.Headers.TryGetValue(Headers.TimeSent, out timeSentString))
                {
                    return(TaskEx.CompletedTask);
                }

                criticalTimeCounter.Update(DateTimeExtensions.ToUtcDateTime(timeSentString), e.StartedAt, e.CompletedAt);

                return(TaskEx.CompletedTask);
            });

            context.RegisterStartupTask(() => criticalTimeCounter);
        }
        /// <summary>
        /// <see cref="Feature.Setup" />.
        /// </summary>
        protected internal override void Setup(FeatureConfigurationContext context)
        {
            var counterInstanceName = context.Settings.EndpointName();
            var criticalTimeCounter = new CriticalTimeCounter(counterInstanceName);

            var notifications = context.Settings.Get<NotificationSubscriptions>();

            notifications.Subscribe<ReceivePipelineCompleted>(e =>
            {
                string timeSentString;

                if (!e.ProcessedMessage.Headers.TryGetValue(Headers.TimeSent, out timeSentString))
                {
                    return TaskEx.CompletedTask;
                }

                criticalTimeCounter.Update(DateTimeExtensions.ToUtcDateTime(timeSentString), e.StartedAt, e.CompletedAt);

                return TaskEx.CompletedTask;
            });

            context.RegisterStartupTask(() => criticalTimeCounter);
        }