/// <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); } }
public async Task HandleAsync(T message) { using (PerfLogger.Create(message.GetType().Name)) { await _decorated.HandleAsync(message).ConfigureAwait(false); } }
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); } }
/// <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); } } }
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; } }
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); }
/// <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); }