Share this page

# Third-party support

You can incorporate third-party APIs into your DevWeb scripts using node modules.

In this topic:

## About using third-party data

DevWeb provides the option to use third-party libraries with your DevWeb script. This is implemented with Node.js, providing a native and simple usage of third-party APIs.

For example, if you want your script to emulate Apache Kafka events, you can integrate a Kafka client such as KafkaJS.

You can use the Node.js solution with any third-party product, endlessly extending DevWeb capabilities to support your AUT. The scripts can be run in standalone or integrated mode, and from any OpenText product that supports DevWeb scripts.

For an example of using the Node.js model, see Example using Kafka producer.

## Example using Kafka producer

Apache Kafka is an event-streaming platform that provides unified, high-throughput, low-latency data feeds. Kafka is a distributed system consisting of servers and clients that communicate using a high-performance TCP network protocol. Two key types of client applications are producers, which publish events to Kafka, and consumers, which subscribe to events in Kafka.

Using the node module, you can set up an integration with the native Kafka protocol, to emulate Kafka events in your script. You can then use the script to monitor the health of your Kafka deployment, by measuring message flow and throughput between the Kafka broker and the producer or consumer.

When you use the node module with a DevWeb script, it can pull in the same data as when you use a VuGen Kafka protocol script. However, the DevWeb node.js model provides a more native and simpler option, enabling the reuse of standard Kafka protocol metrics in your DevWeb script.

You can include the DevWeb script in load tests, and then view the received data in the Kafka graphs in Controller and Analysis.

For details on loading third-party modules, see Third party modules and libraries.

Tip: An example script that monitors Kafka producers using the node module integration is available here: DevWeb root folder>\examples\KafkaProducer.

To create a DevWeb script for Kafka testing:

Prerequisite: Node.js must be installed on your computer.

1. Install the relevant node module, for example, KafkaJS.

2. Install package.json, using that exact name. For details on creating a package.json file, see Manage multiple modules via package.json.

3. Use the Node.js require functionality to load the module, for example:

   const {Kafka, logLevel} = require('kafkajs');

4. Add parameters to define the client and brokers (Kafka server and port), and connect to the service.

5. Add functions as required, for example, to use Kafka producer and load Kafka queue to send messages.

Example snippets:

Copy code

    // Connect
    const {Kafka, logLevel} = require('kafkajs');
    let kafkaClient;
    let kafkaProducer;
     {
        kafkaClient = new Kafka({
            clientId: 'demo-producer',
            brokers: ['kafkaserver:9092']
        });
        kafkaProducer = kafkaClient.producer();

        await kafkaProducer.connect();
     });

    //  Producing
            await kafkaProducer.send({
            topic: topic,
            messages: messages,
        });

     // Disconnect
       await kafkaProducer.disconnect();

https://admhelp.microfocus.com Performance Engineering for Developers 8942
Tips to improve your search results... OpenText™ Performance Engineering for Developers Help Center OpenText™ Performance Engineering for Developers Help 26.1-26.3 All View Local Help Center View Online Help Center Version: