diff options
| author | Jakub Lidke | 2023-07-26 12:28:03 +0200 |
|---|---|---|
| committer | Jakub Lidke | 2023-07-26 12:28:03 +0200 |
| commit | 0defbb05bac3f585e75d72c02c9168d1c2de1834 (patch) | |
| tree | 5581f55d82b97f51f47e05ecd2825aca2c059ab3 /src/main/kotlin/dev | |
| parent | ed17a803bfea59274ac1d04663627111c0808fee (diff) | |
fix: add message key value while producing messages to kafka topic
Diffstat (limited to 'src/main/kotlin/dev')
| -rw-r--r-- | src/main/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSender.kt | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSender.kt b/src/main/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSender.kt index 374c0af..9520caa 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSender.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/output/KafkaMtbFileSender.kt @@ -25,15 +25,16 @@ import org.slf4j.LoggerFactory import org.springframework.kafka.core.KafkaTemplate class KafkaMtbFileSender( - private val kafkaTemplate: KafkaTemplate<String, String>, - private val objectMapper: ObjectMapper + private val kafkaTemplate: KafkaTemplate<String, String>, + private val objectMapper: ObjectMapper ) : MtbFileSender { private val logger = LoggerFactory.getLogger(KafkaMtbFileSender::class.java) override fun send(mtbFile: MtbFile): MtbFileSender.Response { return try { - kafkaTemplate.sendDefault(objectMapper.writeValueAsString(mtbFile)) + kafkaTemplate.sendDefault(String.format("{\"pid\": %s, \"eid\": %s}", mtbFile.patient.id, + mtbFile.episode.id), objectMapper.writeValueAsString(mtbFile)) logger.debug("Sent file via KafkaMtbFileSender") MtbFileSender.Response(MtbFileSender.ResponseStatus.UNKNOWN) } catch (e: Exception) { |
