kafaka怎么建立消费组

kafaka怎么建立消费组?1、使用Kafka控制台命令行客户端:
【kafaka怎么建立消费组】
在命令行中输入如下命令:
/kafka-consumer-groups --bootstrap-server --create --group group_name —–topic topic_name
2、使用Kafka Java API:
// Create the consumer configuration Properties props = new Properties(); props.put("bootstrap.servers", "localhost:9092"); props.put("group.id", groupName); // Create a consumer with properties and subscribe to topics Consumer consumer = new KafkaConsumer<>(props); List topics = Arrays.asList(topicName); consumer.subscribe(topics);

    推荐阅读