summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap/cps/ncmp/dmi/notifications/avc/DmiDataAvcEventProducer.java
diff options
context:
space:
mode:
authormpriyank <priyank.maheshwari@est.tech>2023-06-20 13:42:31 +0100
committermpriyank <priyank.maheshwari@est.tech>2023-06-30 12:29:19 +0100
commita9b8d9da4602727ca5810f62d250b6b941664b8c (patch)
tree0f70835cb2e47f209df34ce324a10a92f53e25e0 /src/main/java/org/onap/cps/ncmp/dmi/notifications/avc/DmiDataAvcEventProducer.java
parent1118bedbd3981c12aebcb9fa99e8744a9bf413c3 (diff)
DMI Data AVC RFC8641 and CloudEvent Compliant
- Introduced CloudEvents for DMI Data AVC Events - Kafkatemplate config to support legacy as well as CloudEvents - AvcEvent to be compliant with RFC8641 schema format - Updating the released version of CPS and NCMP 3.3.3 - Refactored the test code to handle the changes related to CloudEvents Issue-ID: CPS-1719 Change-Id: I082bbceda6dc26c860e1eff977ede219296d1875 Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
Diffstat (limited to 'src/main/java/org/onap/cps/ncmp/dmi/notifications/avc/DmiDataAvcEventProducer.java')
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/notifications/avc/DmiDataAvcEventProducer.java20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/notifications/avc/DmiDataAvcEventProducer.java b/src/main/java/org/onap/cps/ncmp/dmi/notifications/avc/DmiDataAvcEventProducer.java
index 4fd46b66..075dcf20 100644
--- a/src/main/java/org/onap/cps/ncmp/dmi/notifications/avc/DmiDataAvcEventProducer.java
+++ b/src/main/java/org/onap/cps/ncmp/dmi/notifications/avc/DmiDataAvcEventProducer.java
@@ -20,9 +20,11 @@
package org.onap.cps.ncmp.dmi.notifications.avc;
+
+import io.cloudevents.CloudEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.onap.cps.ncmp.event.model.AvcEvent;
+import org.apache.kafka.clients.producer.ProducerRecord;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;
@@ -31,16 +33,18 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor
public class DmiDataAvcEventProducer {
- private final KafkaTemplate<String, AvcEvent> kafkaTemplate;
-
+ private final KafkaTemplate<String, CloudEvent> cloudEventKafkaTemplate;
+
/**
- * Sends message to the configured topic with a message key.
+ * Publishing DMI Data AVC event payload as CloudEvent.
*
- * @param requestId the request id
- * @param avcEvent the event to publish
+ * @param requestId the request id
+ * @param cloudAvcEvent event with data as DMI DataAVC event
*/
- public void sendMessage(final String requestId, final AvcEvent avcEvent) {
- kafkaTemplate.send("dmi-cm-events", requestId, avcEvent);
+ public void publishDmiDataAvcCloudEvent(final String requestId, final CloudEvent cloudAvcEvent) {
+ final ProducerRecord<String, CloudEvent> producerRecord =
+ new ProducerRecord<>("dmi-cm-events", requestId, cloudAvcEvent);
+ cloudEventKafkaTemplate.send(producerRecord);
log.debug("AVC event sent");
}
}