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