Ejemplo n.º 1
0
 /// <summary>
 /// Handles the specified message.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="workerNotification">The worker notification.</param>
 public async Task HandleAsync(IReceivedMessageInternal message, IWorkerNotification workerNotification)
 {
     using (_runCodeTimer.NewContext())
     {
         await _handler.HandleAsync(message, workerNotification).ConfigureAwait(false);
     }
 }
Ejemplo n.º 2
0
 public async Task HandleAsync(T message)
 {
     using (PerfLogger.Create(message.GetType().Name))
     {
         await _decorated.HandleAsync(message).ConfigureAwait(false);
     }
 }
Ejemplo n.º 3
0
 public MessageHandlerDescriptor(IMessageHandlerAsync <T> handler, Type type)
 {
     _handle = p =>
               Task.Run(async() => await handler.HandleAsync(p).ConfigureAwait(false))
               .Wait(TimeSpan.FromSeconds(30));
     ParameterType = type;
 }
        /// <summary>
        /// Handles the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="workerNotification">The worker notification.</param>
        /// <returns></returns>
        public async Task HandleAsync(IReceivedMessageInternal message, IWorkerNotification workerNotification)
        {
            var activityContext = message.Extract(_tracer, _headers.StandardHeaders);

            using (var scope = _tracer.StartActivity("MessageHandlerAsync", ActivityKind.Internal, activityContext))
            {
                scope?.AddMessageIdTag(message);
                await _handler.HandleAsync(message, workerNotification);
            }
        }
 public async Task HandleAsync(T message)
 {
     try
     {
         await _decorated.HandleAsync(message).ConfigureAwait(false);
     }
     catch (Exception e)
     {
         _logger.ErrorException($"[SmartPlaylist][Error]: {e.Message}", e);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Handles the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="workerNotification">The worker notification.</param>
        /// <returns></returns>
        public async Task HandleAsync(IReceivedMessageInternal message, IWorkerNotification workerNotification)
        {
            var spanContext = message.Extract(_tracer, _headers.StandardHeaders);

            if (spanContext != null)
            {
                using (IScope scope = _tracer.BuildSpan("MessageHandlerAsync").AddReference(References.FollowsFrom, spanContext).StartActive(finishSpanOnDispose: true))
                {
                    scope.Span.AddMessageIdTag(message);
                    await _handler.HandleAsync(message, workerNotification);
                }
            }
            else
            {
                using (IScope scope = _tracer.BuildSpan("MessageHandlerAsync").StartActive(finishSpanOnDispose: true))
                {
                    scope.Span.AddMessageIdTag(message);
                    await _handler.HandleAsync(message, workerNotification);
                }
            }
        }
Ejemplo n.º 7
0
        public async Task HandleAsync(T message)
        {
            try
            {
                await _decorated.HandleAsync(message).ConfigureAwait(false);
            }
            catch (Exception e)
            {
                await _debugMessageManager.ShowAsync($"[ERROR]: {e.ToString().Substring(0,500)}").ConfigureAwait(false);

                throw;
            }
        }
Ejemplo n.º 8
0
        public async Task HandleAsync(T message)
        {
            var sw = new Stopwatch();

            sw.Start();

            await _decorated.HandleAsync(message).ConfigureAwait(false);

            sw.Stop();

            await _debugMessageManager.ShowAsync($"{message.GetType().Name}:ActionDuration: {FormatElapsedTime(sw)}")
            .ConfigureAwait(false);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Handles the specified message.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="workerNotification">The worker notification.</param>
 /// <returns>
 /// A task
 /// </returns>
 public async Task HandleAsync(IReceivedMessageInternal message, IWorkerNotification workerNotification)
 {
     await _messageHandlerAsync.HandleAsync(message, workerNotification).ConfigureAwait(false);
 }