예제 #1
0
        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();
            }
        }
예제 #2
0
 public void Dispose()
 {
     _rabbitPublisher?.Stop();
     _rabbitPublisher?.Dispose();
 }
예제 #3
0
 public void Stop()
 {
     _publisher?.Stop();
 }
 public void TearDown()
 {
     _publisher.Stop();
 }
예제 #5
0
 public void Stop()
 {
     _publisher?.Stop();
     _log.Info($"<< {nameof(InvoiceConfirmationPublisher)} is stopped.");
 }
예제 #6
0
 public void Dispose()
 {
     _publisher?.Stop();
     _publisher?.Dispose();
 }
        public void QueuePersistenceShouldBeConfiguredExplicitly()
        {
            Assert.Throws <InvalidOperationException>(() => _publisher.Start());

            _publisher.Stop();
        }
예제 #8
0
        public Task StopAsync(CancellationToken cancellationToken)
        {
            _publisher?.Stop();

            return(Task.CompletedTask);
        }
예제 #9
0
 public void Stop()
 {
     _rabbitMqPublisher?.Stop();
 }