Skip to content

Commit

Permalink
Push to topic after fail
Browse files Browse the repository at this point in the history
  • Loading branch information
tba76 committed Sep 6, 2023
1 parent d9be2bb commit f4863cc
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Altinn.Notifications.Core.Models.Notification;
using Altinn.Notifications.Core.Integrations.Interfaces;
using Altinn.Notifications.Core.Models.Notification;
using Altinn.Notifications.Core.Services.Interfaces;
using Altinn.Notifications.Integrations.Configuration;

Expand All @@ -13,14 +14,22 @@ namespace Altinn.Notifications.Integrations.Kafka.Consumers;
public class EmailStatusConsumer : KafkaConsumerBase<EmailStatusConsumer>
{
private readonly IEmailNotificationService _emailNotificationsService;
private readonly IKafkaProducer _producer;
private readonly string _topicName;

/// <summary>
/// Initializes a new instance of the <see cref="EmailStatusConsumer"/> class.
/// </summary>
public EmailStatusConsumer(IEmailNotificationService emailNotificationsService, IOptions<KafkaSettings> settings, ILogger<EmailStatusConsumer> logger)
public EmailStatusConsumer(
IEmailNotificationService emailNotificationsService,
IKafkaProducer producer,
IOptions<KafkaSettings> settings,
ILogger<EmailStatusConsumer> logger)
: base(settings, logger, settings.Value.EmailStatusUpdatedTopicName)
{
_emailNotificationsService = emailNotificationsService;
_producer = producer;
_topicName = settings.Value.EmailStatusUpdatedTopicName;
}

/// <inheritdoc/>
Expand All @@ -43,7 +52,6 @@ private async Task ProcessOrder(string message)

private async Task RetryOrder(string message)
{
// Retry logic - back to kafka?
await Task.CompletedTask;
await _producer.ProduceAsync(_topicName, message!);
}
}

0 comments on commit f4863cc

Please sign in to comment.