summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulien Fontaine <julien.fontaine@bell.ca>2020-07-03 12:07:56 -0400
committerJulien Fontaine <julien.fontaine@bell.ca>2020-07-03 12:41:13 -0400
commitfc710fa771e265841957b4b125b5f85090ae64e6 (patch)
treeab45995ed354054ed8245bd55dea5564b7501f15
parent01e3ff777b995767311be29ad51ebba53cb054c2 (diff)
Add error handling for CDS Kafka Producer callback
Issue-ID: CCSDK-2522 Signed-off-by: Julien Fontaine <julien.fontaine@bell.ca> Change-Id: Ia7aabaa6d978a13fbf657ea6b406e0b37bc02222
-rw-r--r--ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt3
1 files changed, 2 insertions, 1 deletions
diff --git a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt
index e4991d2d8..8de1f05be 100644
--- a/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt
+++ b/ms/blueprintsprocessor/modules/commons/message-lib/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/message/service/KafkaMessageProducerService.kt
@@ -79,7 +79,8 @@ class KafkaMessageProducerService(
headers.forEach { (key, value) -> recordHeaders.add(RecordHeader(key, value.toByteArray())) }
}
val callback = Callback { metadata, exception ->
- log.trace("message published to(${metadata.topic()}), offset(${metadata.offset()}), headers :$headers")
+ if (exception == null) log.trace("message published to(${metadata.topic()}), offset(${metadata.offset()}), headers :$headers")
+ else log.error("ERROR : ${exception.message}")
}
messageTemplate().send(record, callback)
return true