简体   繁体   中英

How can I check from a Java class that an application has consumed a message?

有一个应用程序在消耗了kafka事件之后对数据库进行了一些更改,但是我不知道是否有一种方法可以在消耗了消息后以编程方式检查消息的使用时间(不使用命令线)。

If You want API support you can use the below mentioned links :

https://github.com/yahoo/kafka-manager

KafkaConsumerOffsets

For now I've found this solution:

I create programmatically a KafkaConsumer with the same group.id of the consumer I want to test, then I use the "committed" method to get the latest committed offset for the partition-topic-group of interest.

It's not optimal and later i try to get more low level, but it gets work done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM