li-apache-kafka-clients li-apache-kafka-clients is a wrapper library for the Apache Kafka vanilla clients. It provides additional features such as large message support and auditing to the Java producer and consumer in the open source Apache Kafka.
LiKafkaConsumer<String, byte[]> consumer = new LiKafkaConsumer<>(props);
consumer.subscribe(Arrays.asList("yourTopic"));
while (true) {
ConsumerRecords<String, byte[]> records = consumer.poll(Duration.ofMillis(100));
for (ConsumerRecord<String, byte[]> record : records) {
// 处理消息
}
}
consumer.close();
复制代码
以上步骤可以帮助新手更好地开始使用 li-apache-kafka-clients 项目,并办理一些常见的问题。
li-apache-kafka-clients li-apache-kafka-clients is a wrapper library for the Apache Kafka vanilla clients. It provides additional features such as large message support and auditing to the Java producer and consumer in the open source Apache Kafka.