Skip to content

Kafka Producer

The Kafka Producer is sending message records to a Topic destination to a Kafka messaging server.

Basic Usage

Send record to a given topic (implicitly create producer if needed):

var producer = require("kafka/producer");
producer.topic("topic1", "{}").send("key1", "value1");

Close the producer:

var producer = require("kafka/producer");
producer.close("{}");

Functions


Function Description Returns
topic(destination, configuration) Returns an object representing a Kafka Topic Topic
close(configuration) Closes the Producer -

Configuration object key-value pairs can be taken from https://kafka.apache.org/documentation/#producerconfigs

Objects


Topic

Function Description Returns
send(key, value) Send a message record by a key and value to a Kafka Topic -
Back to top