Skip to content

Commit

Permalink
move initializeQueueMessages to companion object (#15928)
Browse files Browse the repository at this point in the history
  • Loading branch information
brick-green committed Sep 19, 2024
1 parent 672fa54 commit 675b0e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 6 additions & 0 deletions prime-router/src/main/kotlin/common/BaseEngine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import gov.cdc.prime.router.SettingsProvider
import gov.cdc.prime.router.azure.DatabaseAccess
import gov.cdc.prime.router.azure.QueueAccess
import gov.cdc.prime.router.azure.SettingsFacade
import gov.cdc.prime.router.fhirengine.engine.initializeQueueMessages
import gov.cdc.prime.router.serializers.CsvSerializer
import gov.cdc.prime.router.serializers.Hl7Serializer
import org.apache.logging.log4j.kotlin.Logging
Expand All @@ -23,6 +24,11 @@ abstract class BaseEngine(
companion object {
val sequentialLimit = 500

// initialize the json types in PrimeRouterQueueMessage
init {
initializeQueueMessages()
}

/**
* These are all potentially heavyweight objects that
* should only be created once.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import gov.cdc.prime.router.fhirengine.engine.FHIRTranslator
import gov.cdc.prime.router.fhirengine.engine.FhirReceiveQueueMessage
import gov.cdc.prime.router.fhirengine.engine.PrimeRouterQueueMessage
import gov.cdc.prime.router.fhirengine.engine.ReportPipelineMessage
import gov.cdc.prime.router.fhirengine.engine.initializeQueueMessages
import org.apache.commons.lang3.StringUtils
import org.apache.logging.log4j.kotlin.Logging

Expand Down Expand Up @@ -158,8 +157,6 @@ class FHIRFunctions(
logger.debug(
"${StringUtils.removeEnd(engineType, "e")}ing message: $message for the $dequeueCount time"
)
// initialize the json types in PrimeRouterQueueMessage
initializeQueueMessages()

return when (val queueMessage = QueueMessage.deserialize(message)) {
is QueueMessage.ReceiveQueueMessage -> {
Expand Down

0 comments on commit 675b0e1

Please sign in to comment.