Skip to content

Commit

Permalink
fixed settings name (#407)
Browse files Browse the repository at this point in the history
* fixed settings name

* renamed in all classes

* catching all exceptions

* simplified log msg
  • Loading branch information
acn-sbuad authored Feb 2, 2024
1 parent d92abe4 commit f11016b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ public class KafkaSettings
/// <summary>
/// THe name of the general sms queue topic
/// </summary>
public string SmsQueTopicName { get; set; } = string.Empty;
public string SmsQueueTopicName { get; set; } = string.Empty;
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public SmsNotificationService(
_dateTime = dateTime;
_repository = repository;
_producer = producer;
_smsQueueTopicName = kafkaSettings.Value.SmsQueTopicName;
_smsQueueTopicName = kafkaSettings.Value.SmsQueueTopicName;
}

/// <inheritdoc/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ public async Task<bool> ProduceAsync(string topic, string message)
_logger.LogError(ex, "// KafkaProducer // ProduceAsync // Permanent error: {Message} for message (value: '{DeliveryResult}')", ex.Message, ex.DeliveryResult.Value);
return false;
}
catch (Exception ex)
{
_logger.LogError(ex, "// KafkaProducer // ProduceAsync // An exception occurred.");
return false;
}

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private HttpClient GetTestClient()
});
services.Configure<Core.Configuration.KafkaSettings>(opts =>
{
opts.SmsQueTopicName = _topicName;
opts.SmsQueueTopicName = _topicName;
});

// Set up mock authentication and authorization
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,6 @@ private static SmsNotificationService GetTestService(ISmsNotificationRepository?
producer = producerMock.Object;
}

return new SmsNotificationService(guidService.Object, dateTimeService.Object, repo, producer, Options.Create(new KafkaSettings { SmsQueTopicName = _smsQueueTopicName }));
return new SmsNotificationService(guidService.Object, dateTimeService.Object, repo, producer, Options.Create(new KafkaSettings { SmsQueueTopicName = _smsQueueTopicName }));
}
}

0 comments on commit f11016b

Please sign in to comment.