public async Task ReceiveAsync <T>(T @event, CancellationToken cancellationToken = default) where T : IEvent { var stopWatch = new Stopwatch(); _metrics.Increment(new RequestCounterMetric(@event)); _metrics.Increment(new RequestGaugeMetric("generic_request_gauge", "Current request count")); try { stopWatch.Start(); await _next.ReceiveAsync(@event, cancellationToken); stopWatch.Stop(); _metrics.Observe(new RequestDurationMetric(@event), stopWatch.ElapsedMilliseconds); } catch (Exception exception) { stopWatch.Stop(); _metrics.Increment(new RequestFailureMetric(@event, exception)); throw; } finally { _metrics.Decrement(new RequestGaugeMetric("generic_request_gauge", "Current request count")); } }
public async Task ReceiveAsync <T>(T @event, ICorrelation correlation, CancellationToken cancellationToken = default) where T : IEvent { await _receiver.ReceiveAsync(@event, cancellationToken); }
public async Task ReceiveAsync <T>(T @event, CancellationToken cancellationToken = default) where T : IEvent { Enrich(Options.EventIdPropertyName, @event.EventId); await _next.ReceiveAsync(@event, cancellationToken); }
public async Task ReceiveAsync <TEvent>(TEvent @event, CancellationToken cancellationToken = default) where TEvent : IEvent { _log.Verbose("Receiving {eventType} on http", @event.DisplayName()); await _eventReceiver.ReceiveAsync(@event, cancellationToken); }
public async Task ReceiveAsync <T>(T @event, BasicDeliverEventArgs args, CancellationToken cancellationToken) where T : IEvent { await _eventReceiver.ReceiveAsync(@event, cancellationToken); }