Java, How to get number of messages in a topic in apache kafka

后端 未结 17 1487
不思量自难忘°
不思量自难忘° 2020-11-30 19:11

I am using apache kafka for messaging. I have implemented the producer and consumer in Java. How can we get the number of messages in a topic?

17条回答
  •  悲&欢浪女
    2020-11-30 19:38

    Use https://prestodb.io/docs/current/connector/kafka-tutorial.html

    A super SQL engine, provided by Facebook, that connects on several data sources (Cassandra, Kafka, JMX, Redis ...).

    PrestoDB is running as a server with optional workers (there is a standalone mode without extra workers), then you use a small executable JAR (called presto CLI) to make queries.

    Once you have configured well the Presto server , you can use traditionnal SQL:

    SELECT count(*) FROM TOPIC_NAME;
    

提交回复
热议问题