public async Task PublishAsync(List <TradeLogItem> message) { await _lock.WaitAsync(); try { var publishStart = DateTime.UtcNow; await _publisher.ProduceAsync(message); var publishTime = DateTime.UtcNow.Subtract(publishStart); if (publishTime > _timeThreshold) { _log.WriteWarning(nameof(TradesPublisher), nameof(PublishAsync), $"Long publish ({publishTime}): {message.ToJson()}"); _publisher.Stop(); _publisher.Start(); } } finally { _lock.Release(); } }
public void Dispose() { _rabbitPublisher?.Stop(); _rabbitPublisher?.Dispose(); }
public void Stop() { _publisher?.Stop(); }
public void TearDown() { _publisher.Stop(); }
public void Stop() { _publisher?.Stop(); _log.Info($"<< {nameof(InvoiceConfirmationPublisher)} is stopped."); }
public void Dispose() { _publisher?.Stop(); _publisher?.Dispose(); }
public void QueuePersistenceShouldBeConfiguredExplicitly() { Assert.Throws <InvalidOperationException>(() => _publisher.Start()); _publisher.Stop(); }
public Task StopAsync(CancellationToken cancellationToken) { _publisher?.Stop(); return(Task.CompletedTask); }
public void Stop() { _rabbitMqPublisher?.Stop(); }