SpringBoot整合Kafka消费者Consumer

    感谢您抽出时间来阅读本文章,期待您的点赞和评论互动!

public class KafkaConsumerTest {

    public static Properties getProperties() {
        Properties props = new Properties();
​
        //broker地址
        props.put("bootstrap.servers", "IP:PORT");
​
        //消费者分组ID,分组内的消费者只能消费该消息一次,不同分组内的消费者可以重复消费该消息
        props.put("group.id", "GROUPID");
​
        //开启自动提交offset
        props.put("enable.auto.commit", "true");
​
        //自动提交offset延迟时间
        props.put("auto.commit.interval.ms", "1000");
​
        //反序列化
        props.put("key.deserializer&#

你可能感兴趣的:(kafka从小白变小黑,spring,boot,kafka,java,分布式,zookeeper)