Kafka on Pulsar (KoP) brings the native Apache Kafka protocol support to Apache Pulsar by introducing a Kafka protocol handler on Pulsar brokers. By adding the KoP protocol handler to your existing Pulsar cluster, you can now migrate your existing Kafka applications and services to Pulsar without modifying the code.
To enable KoP access within a Kubernetes cluster, you can configure the <components>.kop
property of the StreamNative Platform in the values.yaml
YAML file as follows, and use the helm upgrade
command to update the resource.
Enable KoP.
Apply the new configuration.
To access KoP outside a Kubernetes cluster, you need to install Istio and Istio Ingress Gateway, and enable TLS for Istio Ingress Gateway. For details, see configure Istio.
This example shows how to use the Kafka Java client to connect to a Pulsar cluster and then produce and consume messages to and from the Pulsar cluster.
Currently, StreamNative Platform supports Kafka Client v1.0.0 - v2.6.0.
Grant produce and consume permission to the Admin role on the namespace.
Configure KoP SSL connection and enable KoP.
KoP starts up together with the Pulsar broker. By default, KoP is enabled. You can set the following options based on your KoP SSL connection.
Get the external IP address of the Istio gateway service.
Install Kafka client.
a. Download the Kafka client 2.2.0. In this example, Kafka 2.2.0 is used because the default configuration of the producer’s retries
parameter is changed from 0
to 2147483647
since Kafka 2.1.0.
b. Extract the downloaded package.
Prepare a file named client-ssl.properties
. The file contains the following information.
Run a Kafka client.
a. Enter the Kafka client directory.
b. Start a Kafka producer and send a message from the Kafka producer..
c. Start a Kafka consumer.
At the same time, you can receive the message message-for-kafka-client
.
Kafka on Pulsar (KoP) brings the native Apache Kafka protocol support to Apache Pulsar by introducing a Kafka protocol handler on Pulsar brokers. By adding the KoP protocol handler to your existing Pulsar cluster, you can now migrate your existing Kafka applications and services to Pulsar without modifying the code.
To enable KoP access within a Kubernetes cluster, you can configure the <components>.kop
property of the StreamNative Platform in the values.yaml
YAML file as follows, and use the helm upgrade
command to update the resource.
Enable KoP.
Apply the new configuration.
To access KoP outside a Kubernetes cluster, you need to install Istio and Istio Ingress Gateway, and enable TLS for Istio Ingress Gateway. For details, see configure Istio.
This example shows how to use the Kafka Java client to connect to a Pulsar cluster and then produce and consume messages to and from the Pulsar cluster.
Currently, StreamNative Platform supports Kafka Client v1.0.0 - v2.6.0.
Grant produce and consume permission to the Admin role on the namespace.
Configure KoP SSL connection and enable KoP.
KoP starts up together with the Pulsar broker. By default, KoP is enabled. You can set the following options based on your KoP SSL connection.
Get the external IP address of the Istio gateway service.
Install Kafka client.
a. Download the Kafka client 2.2.0. In this example, Kafka 2.2.0 is used because the default configuration of the producer’s retries
parameter is changed from 0
to 2147483647
since Kafka 2.1.0.
b. Extract the downloaded package.
Prepare a file named client-ssl.properties
. The file contains the following information.
Run a Kafka client.
a. Enter the Kafka client directory.
b. Start a Kafka producer and send a message from the Kafka producer..
c. Start a Kafka consumer.
At the same time, you can receive the message message-for-kafka-client
.