Skip to content

kafka/producer

Documentation

Overview

Classes

Producer

topic()

Creates a new topic configuration wrapper that can be used to send messages to a specific Kafka topic.

ts
static topic(destination: string, configuration: any): Topic;
ParameterTypeDescription
destinationstringThe name of the Kafka topic to send messages to.
configurationanyOptional key-value object containing Kafka producer properties

(e.g., 'bootstrap.servers', 'acks'). |

Returns

  • Type: Topic
  • Description: A Topic instance configured for the specified destination and properties.

close()

Closes the Kafka producer connection pool, releasing associated resources. This should be called when message sending is complete to ensure proper cleanup.

ts
static close(configuration: any): void;
ParameterTypeDescription
configurationanyOptional key-value object containing the configuration

used to initialize the producer to be closed. |

Returns

  • Type: void
  • Description: