diff --git a/src/Altinn.Notifications.Core/Configuration/KafkaSettings.cs b/src/Altinn.Notifications.Core/Configuration/KafkaSettings.cs index fea1f8c3..568af362 100644 --- a/src/Altinn.Notifications.Core/Configuration/KafkaSettings.cs +++ b/src/Altinn.Notifications.Core/Configuration/KafkaSettings.cs @@ -18,5 +18,5 @@ public class KafkaSettings /// /// THe name of the general sms queue topic /// - public string SmsQueTopicName { get; set; } = string.Empty; + public string SmsQueueTopicName { get; set; } = string.Empty; } diff --git a/src/Altinn.Notifications.Core/Services/SmsNotificationService.cs b/src/Altinn.Notifications.Core/Services/SmsNotificationService.cs index c29902a7..23a71c12 100644 --- a/src/Altinn.Notifications.Core/Services/SmsNotificationService.cs +++ b/src/Altinn.Notifications.Core/Services/SmsNotificationService.cs @@ -36,7 +36,7 @@ public SmsNotificationService( _dateTime = dateTime; _repository = repository; _producer = producer; - _smsQueueTopicName = kafkaSettings.Value.SmsQueTopicName; + _smsQueueTopicName = kafkaSettings.Value.SmsQueueTopicName; } /// diff --git a/src/Altinn.Notifications.Integrations/Kafka/Producers/KafkaProducer.cs b/src/Altinn.Notifications.Integrations/Kafka/Producers/KafkaProducer.cs index 852c1bc5..b1f07e6b 100644 --- a/src/Altinn.Notifications.Integrations/Kafka/Producers/KafkaProducer.cs +++ b/src/Altinn.Notifications.Integrations/Kafka/Producers/KafkaProducer.cs @@ -61,6 +61,11 @@ public async Task 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; } diff --git a/test/Altinn.Notifications.IntegrationTests/Notifications/TriggerController/Trigger_SendSmsNotificationsTests.cs b/test/Altinn.Notifications.IntegrationTests/Notifications/TriggerController/Trigger_SendSmsNotificationsTests.cs index 00b356ce..916b5417 100644 --- a/test/Altinn.Notifications.IntegrationTests/Notifications/TriggerController/Trigger_SendSmsNotificationsTests.cs +++ b/test/Altinn.Notifications.IntegrationTests/Notifications/TriggerController/Trigger_SendSmsNotificationsTests.cs @@ -80,7 +80,7 @@ private HttpClient GetTestClient() }); services.Configure(opts => { - opts.SmsQueTopicName = _topicName; + opts.SmsQueueTopicName = _topicName; }); // Set up mock authentication and authorization diff --git a/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/SmsNotificationServiceTests.cs b/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/SmsNotificationServiceTests.cs index 0b06baf6..fdecfcc5 100644 --- a/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/SmsNotificationServiceTests.cs +++ b/test/Altinn.Notifications.Tests/Notifications.Core/TestingServices/SmsNotificationServiceTests.cs @@ -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 })); } }