Quick start
Prerequisites
The prerequisites for connecting an Kafka sink connector to external systems include: Apache Kafka: Ensure you have a running Kafka instance. You can follow the official Kafka Quickstart guide to set up a Kafka instance if you don’t have one already.1. Create a connector
The following command shows how to use pulsarctl to create abuiltin connector. If you want to create a non-builtin connector,
you need to replace --sink-type kafka with --archive /path/to/pulsar-io-kafka.nar. You can find the button to download the nar package at the beginning of the document.
If you are a StreamNative Cloud user, you need set up your environment first.
--sink-config is the minimum necessary configuration for starting this connector, and it is a JSON string. You need to substitute the relevant parameters with your own.
If you want to configure more parameters, see Configuration Properties for reference.
You can also choose to use a variety of other tools to create a connector:
- pulsar-admin: The command arguments for
pulsar-adminare similar to those ofpulsarctl. You can find an example for StreamNative Cloud Doc. - RestAPI: You can find an example for StreamNative Cloud Doc.
- Terraform: You can find an example for StreamNative Cloud Doc.
- Function Mesh: The docker image can be found at the beginning of the document.
2. Send messages to the topic
If your connector is created on StreamNative Cloud, you need to authenticate your clients. See Build applications using Pulsar clients for more information.
3. Check the data on kafka topic
You can consume the data from the kafka topic using the command:Configuration Properties
This table outlines the properties of a Kafka sink connector.| Name | Type | Required | Default | Description |
|---|---|---|---|---|
bootstrapServers | String | true | ” ” (empty string) | A comma-separated list of host and port pairs for establishing the initial connection to the Kafka cluster. |
acks | String | true | ” ” (empty string) | The number of acknowledgments that the producer requires the leader to receive before a request completes. This controls the durability of the sent records. |
batchsize | long | false | 16384L | The batch size that a Kafka producer attempts to batch records together before sending them to brokers. |
maxRequestSize | long | false | 1048576L | The maximum size of a Kafka request in bytes. |
topic | String | true | ” ” (empty string) | The Kafka topic which receives messages from Pulsar. |
keyDeserializationClass | String | false | org.apache.kafka.common.serialization.StringSerializer | The serializer class for Kafka producers to serialize keys. |
valueDeserializationClass | String | false | org.apache.kafka.common.serialization.ByteArraySerializer | The serializer class for Kafka producers to serialize values. The serializer is set by a specific implementation of KafkaAbstractSink. |
producerConfigProperties | Map | false | ” ” (empty string) | The producer configuration properties to be passed to producers. Note: other properties specified in the connector configuration file take precedence over this configuration. |

































