This project contains a confluent-kafka-javascript application that produces string values to a topic in Confluent Cloud. Of note: this project uses the promisified API similar to KafkaJS, see the migration guide for more details on the differences between it and KafkaJS.
It's assumed that you have node and npm installed. Node must be a version >=18.0.0 to install confluent-kafka-javascript.
Another assumption: that you have set up a cluster in the Confluent Cloud environment with a topic, a bootstrap server, and you have created an api key and secret. Follow the instructions in the Confluent documentation if you are unsure of how to do this.
To install the dependencies:
npm installRun this command to start the producer:
node producer.jsYou will also likely want to add a serializer when you customize the message produced. There is some more information about how to do this using the confluent-kafka-javascript client here.
Lucia Cerchie - lcerchie@confluent.io