/*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2024 Nordix Foundation
+ *  Copyright (C) 2024-2025 Nordix Foundation
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
  *  ============LICENSE_END=========================================================
  */
 
-import { crypto } from 'k6/experimental/webcrypto';
-import { check } from 'k6';
-import { Writer, SchemaRegistry, SCHEMA_TYPE_STRING } from 'k6/x/kafka';
+import {crypto} from 'k6/experimental/webcrypto';
+import {check} from 'k6';
+import {Writer, SchemaRegistry, SCHEMA_TYPE_STRING} from 'k6/x/kafka';
 
 const testEventPayload = JSON.stringify(JSON.parse(open('../../resources/sampleAvcInputEvent.json')));
 const schemaRegistry = new SchemaRegistry();
+let messagesSent = 0;
+
 const kafkaProducer = new Writer({
     brokers: ['localhost:9092'],
     topic: 'dmi-cm-events',
     requestTimeout: 30000
 });
 
-const TOTAL_MESSAGES = 100000;
-const VIRTUAL_USERS = 1000;
-
-export const options = {
-    setupTimeout: '1m',
-    teardownTimeout: '1m',
-    scenarios: {
-        produceKafkaMessages: {
-            executor: 'shared-iterations',
-            exec: 'sendKafkaMessages',
-            vus: VIRTUAL_USERS,
-            iterations: TOTAL_MESSAGES,
-            maxDuration: '10m',
-        }
-    }
-};
-
 const getRandomNetworkElement = () => {
-    const networkElementIds = Array.from({ length: 10 }, (_, i) => `neType-${i + 1}`);
-    return networkElementIds[Math.floor(Math.random() * networkElementIds.length)];
+    return `neType-${Math.floor(Math.random() * 10) + 1}`;
 };
 
 function getCloudEventHeaders() {
 }
 
 export function sendKafkaMessages() {
+
     const cloudEventHeaders = getCloudEventHeaders();
     const networkElementId = getRandomNetworkElement();
 
     };
 
     try {
-        kafkaProducer.produce({ messages: [avcCloudEvent] });
-
+        kafkaProducer.produce({messages: [avcCloudEvent]});
+        messagesSent++;
         const isMessageSent = check(kafkaProducer, {
             'Message sent successfully': (producer) => producer != null,
         });
         if (!isMessageSent) {
             console.error('Failed to send message:', avcCloudEvent);
         }
-
     } catch (error) {
-        console.error('Error during message production:', error, avcCloudEvent);
+        console.error(`Error during message production: ${error.message}`, avcCloudEvent);
     }
 }
 
 
 /*
  *  ============LICENSE_START=======================================================
- *  Copyright (C) 2024 Nordix Foundation
+ *  Copyright (C) 2024-2025 Nordix Foundation
  *  ================================================================================
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
 import { createCmHandles, deleteCmHandles, waitForAllCmHandlesToBeReady } from './common/cmhandle-crud.js';
 import { executeCmHandleSearch, executeCmHandleIdSearch } from './common/search-base.js';
 import { passthroughRead, passthroughWrite, legacyBatchRead } from './common/passthrough-crud.js';
+import { sendKafkaMessages } from './common/produce-avc-event.js';
 
 let cmHandlesCreatedPerSecondTrend = new Trend('cmhandles_created_per_second', false);
 let cmHandlesDeletedPerSecondTrend = new Trend('cmhandles_deleted_per_second', false);
     check(response, { 'data operation batch read status equals 200': (r) => r.status === 200 });
 }
 
+export function produceAvcEventsScenario() {
+    sendKafkaMessages();
+}
+
 export function legacyBatchConsumeScenario() {
     const TOTAL_MESSAGES_TO_CONSUME = LEGACY_BATCH_THROUGHPUT_TEST_NUMBER_OF_REQUESTS * LEGACY_BATCH_THROUGHPUT_TEST_BATCH_SIZE;
     try {