From 2dd658268202f92e0b5621093747f13670e5d042 Mon Sep 17 00:00:00 2001 From: mpriyank Date: Mon, 4 Nov 2024 15:59:58 +0000 Subject: Cm Avc Event to have same key - incoming Cm Avc Event from DMI Plugin is consumed and forwarded to target topic - the key from source topic to be used in the target topic while forwarding - with same key the ordering of the message will be preserved - NOTE: the RTD related changes will be a separate patchset Issue-ID: CPS-2436 Change-Id: Ie692663706b378022ec0d621d92ca5054bad8d1b Signed-off-by: mpriyank --- k6-tests/once-off-test/kafka/produce-avc-event.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'k6-tests') diff --git a/k6-tests/once-off-test/kafka/produce-avc-event.js b/k6-tests/once-off-test/kafka/produce-avc-event.js index 981a21af65..db222f6a4a 100644 --- a/k6-tests/once-off-test/kafka/produce-avc-event.js +++ b/k6-tests/once-off-test/kafka/produce-avc-event.js @@ -50,6 +50,11 @@ export const options = { } }; +const getRandomNetworkElement = () => { + const networkElementIds = Array.from({ length: 10 }, (_, i) => `neType-${i + 1}`); + return networkElementIds[Math.floor(Math.random() * networkElementIds.length)]; +}; + function getCloudEventHeaders() { return { ce_type: 'org.onap.cps.ncmp.events.avc1_0_0.AvcEvent', @@ -65,10 +70,11 @@ function getCloudEventHeaders() { export function sendKafkaMessages() { const cloudEventHeaders = getCloudEventHeaders(); + const networkElementId = getRandomNetworkElement(); const avcCloudEvent = { key: schemaRegistry.serialize({ - data: cloudEventHeaders.ce_correlationid, + data: networkElementId, schemaType: SCHEMA_TYPE_STRING, }), value: schemaRegistry.serialize({ -- cgit 1.2.3-korg