11using Confluent . Kafka ;
22using Confluent . Kafka . Extensions . Diagnostics ;
33using Hl7 . Fhir . Model ;
4- using Hl7 . Fhir . Serialization ;
54using LantanaGroup . Link . Normalization . Application . Models . Exceptions ;
65using LantanaGroup . Link . Normalization . Application . Models . Messages ;
76using LantanaGroup . Link . Normalization . Application . Models . Operations ;
1817using LantanaGroup . Link . Shared . Application . Models . Telemetry ;
1918using LantanaGroup . Link . Shared . Application . SerDes ;
2019using LantanaGroup . Link . Shared . Application . Utilities ;
21- using Microsoft . Extensions . Options ;
2220using System . Text ;
2321using System . Text . Json ;
2422using Task = System . Threading . Tasks . Task ;
@@ -36,6 +34,7 @@ public class ResourceAcquiredListener : BackgroundService
3634 private bool _cancelled = false ;
3735 private readonly INormalizationServiceMetrics _metrics ;
3836 private readonly IServiceScopeFactory _scopeFactory ;
37+ private readonly ServiceInformation _serviceInformation ;
3938
4039 private readonly CopyPropertyOperationService _copyPropertyOperationService ;
4140 private readonly CodeMapOperationService _codeMapOperationService ;
@@ -44,7 +43,7 @@ public class ResourceAcquiredListener : BackgroundService
4443
4544 public ResourceAcquiredListener (
4645 ILogger < ResourceAcquiredListener > logger ,
47- IOptions < ServiceInformation > serviceInformation ,
46+ ServiceInformation serviceInformation ,
4847 IServiceScopeFactory scopeFactory ,
4948 IKafkaConsumerFactory < string , ResourceAcquiredMessage > consumerFactory ,
5049 IDeadLetterExceptionHandler < string , string > consumeExceptionHandler ,
@@ -60,19 +59,21 @@ public ResourceAcquiredListener(
6059 this . _logger = logger ?? throw new ArgumentNullException ( nameof ( logger ) ) ;
6160 _consumerFactory = consumerFactory ?? throw new ArgumentNullException ( nameof ( consumerFactory ) ) ;
6261 _consumeExceptionHandler = consumeExceptionHandler ?? throw new ArgumentNullException ( nameof ( consumeExceptionHandler ) ) ;
63- _consumeExceptionHandler . ServiceName = serviceInformation . Value . ServiceName ;
62+
6463 _consumeExceptionHandler . Topic = $ "{ nameof ( KafkaTopic . ResourceAcquired ) } -Error";
6564 _deadLetterExceptionHandler = deadLetterExceptionHandler ?? throw new ArgumentNullException ( nameof ( deadLetterExceptionHandler ) ) ;
66- _deadLetterExceptionHandler . ServiceName = serviceInformation . Value . ServiceName ;
65+
6766 _deadLetterExceptionHandler . Topic = $ "{ nameof ( KafkaTopic . ResourceAcquired ) } -Error";
6867 _transientExceptionHandler = transientExceptionHandler ;
69- _transientExceptionHandler . ServiceName = serviceInformation . Value . ServiceName ;
68+
7069 _transientExceptionHandler . Topic = KafkaTopic . ResourceAcquiredRetry . GetStringValue ( ) ;
7170 _metrics = metrics ?? throw new ArgumentNullException ( nameof ( metrics ) ) ;
7271
7372 _scopeFactory = scopeFactory ;
7473 _producer = producer ?? throw new ArgumentNullException ( nameof ( producer ) ) ;
7574
75+ _serviceInformation = serviceInformation ?? throw new ArgumentNullException ( nameof ( serviceInformation ) ) ;
76+
7677 _copyPropertyOperationService = copyPropertyOperationService ;
7778 _codeMapOperationService = codeMapOperationService ?? throw new ArgumentNullException ( nameof ( codeMapOperationService ) ) ;
7879 _conditionalTransformOperationService = conditionalTransformOperationService ?? throw new ArgumentNullException ( nameof ( conditionalTransformOperationService ) ) ;
@@ -88,7 +89,7 @@ private async Task StartConsumerLoop(CancellationToken cancellationToken)
8889 {
8990 using var kafkaConsumer = _consumerFactory . CreateConsumer ( new ConsumerConfig
9091 {
91- GroupId = NormalizationConstants . ServiceName ,
92+ GroupId = _serviceInformation . ServiceConfigName ,
9293 EnableAutoCommit = false
9394 } ) ;
9495
0 commit comments