From 9258b5d66a7f565fff24093b376436496ba006f0 Mon Sep 17 00:00:00 2001 From: Arnej <118766341+arnejduranovic@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:51:23 -0600 Subject: [PATCH] 16609 part 2 fix (#16616) Update FHIRFunctions to encode poison queue message in the case of SubmissionSenderNotFound --- .../src/main/kotlin/fhirengine/azure/FHIRFunctions.kt | 3 ++- .../kotlin/fhirengine/azure/FHIRConverterIntegrationTests.kt | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/prime-router/src/main/kotlin/fhirengine/azure/FHIRFunctions.kt b/prime-router/src/main/kotlin/fhirengine/azure/FHIRFunctions.kt index 8d10d783e17..0166b734662 100644 --- a/prime-router/src/main/kotlin/fhirengine/azure/FHIRFunctions.kt +++ b/prime-router/src/main/kotlin/fhirengine/azure/FHIRFunctions.kt @@ -214,7 +214,8 @@ class FHIRFunctions( actionLogger.errors.takeIf { it.isNotEmpty() }?.map { it.detail.message }?.toString() ) submissionTableService.insertSubmission(tableEntity) - queueAccess.sendMessage("${messageContent.messageQueueName}-poison", message) + val encodedMsg = Base64.getEncoder().encodeToString(message.toByteArray()) + queueAccess.sendMessage("${messageContent.messageQueueName}-poison", encodedMsg) return emptyList() } catch (ex: Exception) { // We're catching anything else that occurs because the most likely cause is a code or configuration error diff --git a/prime-router/src/test/kotlin/fhirengine/azure/FHIRConverterIntegrationTests.kt b/prime-router/src/test/kotlin/fhirengine/azure/FHIRConverterIntegrationTests.kt index a5a553442a5..e95fb3d5806 100644 --- a/prime-router/src/test/kotlin/fhirengine/azure/FHIRConverterIntegrationTests.kt +++ b/prime-router/src/test/kotlin/fhirengine/azure/FHIRConverterIntegrationTests.kt @@ -96,6 +96,7 @@ import tech.tablesaw.api.StringColumn import tech.tablesaw.api.Table import java.nio.charset.Charset import java.time.OffsetDateTime +import java.util.Base64 import java.util.UUID @Testcontainers @@ -334,8 +335,7 @@ class FHIRConverterIntegrationTests { verify(exactly = 1) { QueueAccess.sendMessage( "${QueueMessage.elrSubmissionConvertQueueName}-poison", - queueMessage - + Base64.getEncoder().encodeToString(queueMessage.toByteArray()) ) } }