Skip to content

Commit

Permalink
Merge pull request #590 from bcgov/BCPSDEMS-1902-cornet-services
Browse files Browse the repository at this point in the history
Change log
  • Loading branch information
leewrigh authored Jul 2, 2024
2 parents 3805bed + e91fd30 commit 70e9614
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions backend/DIAMCornetService/Services/CornetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace DIAMCornetService.Services;
using DIAMCornetService.Exceptions;
using DIAMCornetService.Models;

public class CornetService(ILogger logger, IKafkaProducer<string, ParticipantCSNumberModel> producer, DIAMCornetServiceConfiguration cornetServiceConfiguration, ICornetORDSClient cornetORDSClient) : ICornetService
public class CornetService(IKafkaProducer<string, ParticipantCSNumberModel> producer, DIAMCornetServiceConfiguration cornetServiceConfiguration, ICornetORDSClient cornetORDSClient) : ICornetService
{

/// <summary>
Expand Down Expand Up @@ -62,7 +62,7 @@ public async Task<ParticipantCSNumberModel> GetParticipantCSNumberAsync(string p
break;

default:
logger.LogWarning($"Participant {participantId} unhandled response returned {response.ErrorMessage}");
logger.LogWarning($"Participant {participantId} unhandled response returned {responseModel.ErrorMessage}");
responseModel.ErrorMessage = "Participant {participantId} unhandled response returned {response.ErrorMessage}";
responseModel.ErrorType = CornetCSNumberErrorType.unknownResponseError;
break;
Expand Down Expand Up @@ -98,7 +98,7 @@ public async Task<Dictionary<string, string>> PublishCSNumberResponseAsync(strin

if (response.Status != PersistenceStatus.Persisted)
{
CornetServiceLogging.FailedToPublishCSNumberMapping(logger, new DIAMKafkaException($"Failed to publish cs number mapping for {guid.ToString()} Part: {csNumberLookupResponse.ParticipantId} CSNumber: {csNumberLookupResponse.CSNumber}"));
logger.LogError($"Failed to publish CS number lookup to topic for {participantId}");
throw new DIAMKafkaException($"Failed to publish cs number mapping for {guid.ToString()} Part: {csNumberLookupResponse.ParticipantId} CSNumber: {csNumberLookupResponse.CSNumber}");
}
else
Expand All @@ -112,7 +112,7 @@ public async Task<Dictionary<string, string>> PublishCSNumberResponseAsync(strin
}
catch (Exception ex)
{
CornetLoggingExtensions.FailedToPublishNotification(logger, participantId);
logger.LogError($"Failed to publish CS number lookup to topic for {participantId} [{ex.Message}]");
throw;
}
}
Expand Down Expand Up @@ -142,8 +142,3 @@ public async Task<int> SubmitNotificationToEServices(string csNumber, string mes

}

public static partial class CornetLoggingExtensions
{
[LoggerMessage(1, LogLevel.Error, "Failed to publish cs number mapping for participant {ParticipantId}", EventName = "PublishError")]
public static partial void FailedToPublishNotification(ILogger logger, string ParticipantId);
}

0 comments on commit 70e9614

Please sign in to comment.