From bdf609572b2a62df00e044f4bae38e4c6c8ce4e7 Mon Sep 17 00:00:00 2001 From: mpriyank Date: Tue, 21 Mar 2023 09:59:00 +0000 Subject: Add event to mapper as well - Explicitly add event to the mapper - Also parameterized the cm-events topic to be overridden later Issue-ID: CPS-1554 Change-Id: Ia6e75117dbb4214648d40318989c4c5fe6fd69f1 Signed-off-by: mpriyank --- .../onap/cps/ncmp/api/impl/notifications/avc/AvcEventMapper.java | 1 + .../cps/ncmp/api/impl/notifications/avc/AvcEventProducer.java | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'cps-ncmp-service/src/main/java/org') diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/notifications/avc/AvcEventMapper.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/notifications/avc/AvcEventMapper.java index b6dc467773..aaa06c6659 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/notifications/avc/AvcEventMapper.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/notifications/avc/AvcEventMapper.java @@ -40,6 +40,7 @@ public interface AvcEventMapper { @Mapping(source = "eventSchemaVersion", target = "eventSchemaVersion") @Mapping(source = "eventSource", target = "eventSource") @Mapping(source = "eventType", target = "eventType") + @Mapping(source = "event", target = "event") AvcEvent toOutgoingAvcEvent(AvcEvent incomingAvcEvent); @Named("avcEventId") diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/notifications/avc/AvcEventProducer.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/notifications/avc/AvcEventProducer.java index 049f66100b..b8fe730a16 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/notifications/avc/AvcEventProducer.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/notifications/avc/AvcEventProducer.java @@ -23,6 +23,7 @@ package org.onap.cps.ncmp.api.impl.notifications.avc; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.onap.cps.ncmp.event.model.AvcEvent; +import org.springframework.beans.factory.annotation.Value; import org.springframework.kafka.core.KafkaTemplate; import org.springframework.stereotype.Service; @@ -38,6 +39,9 @@ public class AvcEventProducer { private final AvcEventMapper avcEventMapper; + @Value("${app.ncmp.avc.cm-events-topic}") + private String cmEventsTopic; + /** * Sends message to the configured topic with a message key. * @@ -46,7 +50,7 @@ public class AvcEventProducer { public void sendMessage(final AvcEvent incomingAvcEvent) { // generate new event id while keeping other data final AvcEvent outgoingAvcEvent = avcEventMapper.toOutgoingAvcEvent(incomingAvcEvent); - log.debug("Forwarding AVC event {} to topic {} ", outgoingAvcEvent.getEventId(), "cm-events"); - kafkaTemplate.send("cm-events", outgoingAvcEvent.getEventId(), outgoingAvcEvent); + log.debug("Forwarding AVC event {} to topic {} ", outgoingAvcEvent.getEventId(), cmEventsTopic); + kafkaTemplate.send(cmEventsTopic, outgoingAvcEvent.getEventId(), outgoingAvcEvent); } } -- cgit 1.2.3-korg