Kafka Producer
The Kafka Producer is sending message records to a Topic destination to a Kafka messaging server.
- Module:
kafka/producer - Alias:
kafka/producer - Definition: https://github.com/eclipse/dirigible/issues/640
- Source: /kafka/producer.js
- Facade: KafkaFacade
- Status:
beta - Group:
ext
Basic Usage
Send record to a given topic (implicitly create producer if needed):
import { producer } from "sdk/producer";
producer.topic("topic1", "{}").send("key1", "value1");
Close the producer:
import { producer } from "sdk/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 | - |