diff options
author | mpriyank <priyank.maheshwari@est.tech> | 2022-10-03 12:26:10 +0100 |
---|---|---|
committer | mpriyank <priyank.maheshwari@est.tech> | 2022-10-03 12:44:38 +0100 |
commit | ac0bffc722f22ab407845367eeafed0348c1b094 (patch) | |
tree | 6dd893d7401387f7e0aee6d570fc4b99a4b6a176 /cps-ncmp-service/src/main/java | |
parent | fe7753178f5f1b4814dcf7473ea8c761951d8f02 (diff) |
Swallow kafkaException
- swallow the kafka exception if we are unable to send the kafka message
due to any reason.
- updated release notes as well
Issue-ID: CPS-1294
Change-Id: Iaa8ae5b0bc289d819a46b4a95a1382f4ecee66aa
Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'cps-ncmp-service/src/main/java')
-rw-r--r-- | cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsService.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsService.java index 762b21ef34..d6857d36ae 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsService.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/event/lcm/LcmEventsService.java @@ -24,6 +24,7 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.onap.ncmp.cmhandle.event.lcm.LcmEvent; import org.springframework.beans.factory.annotation.Value; +import org.springframework.kafka.KafkaException; import org.springframework.stereotype.Service; /** @@ -51,7 +52,11 @@ public class LcmEventsService { */ public void publishLcmEvent(final String cmHandleId, final LcmEvent lcmEvent) { if (notificationsEnabled) { - lcmEventsPublisher.publishEvent(topicName, cmHandleId, lcmEvent); + try { + lcmEventsPublisher.publishEvent(topicName, cmHandleId, lcmEvent); + } catch (final KafkaException e) { + log.error("Unable to publish message to topic : {} and cause : {}", topicName, e.getMessage()); + } } else { log.debug("Notifications disabled."); } |