I found there are several kafka in the maven repo.
There are two kafka in the maven repo from apache. https://mvnrepository.com/artifact/org.apache.kafka/kafka https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients
Both of them can produce mesg and consume msg from kafka server.
I want to know the reason for create two kinds of client.
Is there any difference and which one is better?
There is only one clients package, it's included as part of the other. Look at the compile dependencies section under the section where you can copy the POM
If you don't plan on running an embedded Kafka server or any other runtime core dependency of Kafka (such as Kafka Connect or Kafka Streams) or Zookeeper Server, you only need the
kafka-clients
package