public void Listen(CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { _logger.LogInformation($"Requested to cancel listener"); return; } try { _logger.LogInformation($"Message received in EventListener"); _rabbitMQReadClient.Read(message => { if (!string.IsNullOrEmpty(message)) { _listenerHandler.Handle(message); _logger.LogInformation($"Message was successfully handle", message); } }, _settings.QueueName); } catch (Exception ex) { _logger.LogError($"There was error occurred during handle message", ex.Message); throw; } }
public string Read() { return(_readClient.Read("Insurances")); }