mirror of
https://github.com/pcvolkmer/etl-processor.git
synced 2025-04-19 17:26:51 +00:00
fix: add message key value while producing messages to kafka topic
This commit is contained in:
parent
ed17a803bf
commit
0defbb05ba
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user