PulsarKafkaProducer is not thread safe #4707
Labels
type/bug
The PR fixed a bug or issue reported a bug
type/feature
The PR added a new feature or issue requested a new feature
Is your feature request related to a problem? Please describe.
I replaced kafka client with pulsar-client-kafka, referring to this document.
http://pulsar.apache.org/docs/en/adaptors-kafka/
Then, sending messages to multiple topics at the same time caused an exception(NullPointerException).
This exception does not occur in version 2.2.1, but does occur in version 2.3.2 and later.
I think that the change made in this PR is the cause.
Each time you send a message to a new topic, the cluster object is regenerated.
https://github.com/apache/pulsar/blob/v2.3.2/pulsar-client-kafka-compat/pulsar-client-kafka/src/main/java/org/apache/kafka/clients/producer/PulsarKafkaProducer.java#L229
The javadoc states that KafkaProducer is thread safe.
https://kafka.apache.org/20/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html
I want to use pulsar-client-kafka without modifying the code that used Kafka client.
To Reproduce
The text was updated successfully, but these errors were encountered: