编程语言
首页 > 编程语言> > java-Kafka KStream-衡量消费者滞后

java-Kafka KStream-衡量消费者滞后

作者:互联网

由于我的基于KStream的应用程序未遵循传统的Kafka消费者路线,我应如何跟踪消费者的滞后时间?通常我会使用ConsumerOffsetChecker(或类似的值),但是它需要使用者组名称.

我应该怎么用呢?

(我想对此进行跟踪,以便我可以判断是否/何时启动新消费者)

解决方法:

Kafka Streams内部使用KafkaConsumer,并将应用程序ID用作使用者组ID.因此,您可以像监视其他使用者一样监视滞后.

查看http://docs.confluent.io/current/streams/developer-guide.html#required-configuration-parameters

Application Id (application.id): Each stream processing application must have a unique id. […]

This id is used in the following places to isolate resources used by the application from others:

  • As the default Kafka consumer and producer client.id prefix
  • As the Kafka consumer group.id for coordination
  • As the name of the sub-directory in the state directory (cf. state.dir)
  • As the prefix of internal Kafka topic names

标签:apache-kafka-streams,apache-kafka,java
来源: https://codeday.me/bug/20191118/2026468.html