Kafka API实战

4Kafka API实战

1)启动zkkafka集群,在kafka集群中打开一个消费者

[hadoop102 kafka]$ bin/kafka-console-consumer.sh \ --zookeeper hadoop01:2181 --topic first

2)导入pom依赖

 

<dependencies>
   <!-- https://mvnrepository.com/artifact/org.apache.kafka/kafka-clients -->
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka-clients</artifactId>
    <version>2.2.1</version>
</dependency>
    <!-- https://mvnrepository.com/artifact/org.apache.kafka/kafka -->
<dependency>
    <groupId>org.apache.kafka</groupId>
    <artifactId>kafka_2.12</artifactId>
    <version>2.2.1</version>
</dependency>

</dependencies>

 

4.2 Kafka生产者Java API

4.2.1 创建生产过时的API

 

Kafka API实战

上一篇:DevExpress WPF v19.1新版亮点:主题/Tree List等控件新功能


下一篇:【c#基础】集合