How to find no more messages in kafka topic/partition & reading only after writing to topic is done

江枫思渺然 提交于 2020-06-29 05:38:28

问题


I'm using Spring boot version 1.5.4.RELEASE & spring Kafka version 1.3.8.RELEASE.

Some generic questions

  1. is there way to find out no more messages in topic/partition in consumer
  2. how to start consumer to start consuming messages from a topic only after writing from the producer is done?

回答1:


Spring Boot 1.5 is end of life and no longer supported; the current version is 2.2.5.

The latest 1.3.x version of Spring for Apache Kafka is 1.3.10. It will only be supported through the end of this year.

You should plan on upgrading.

You can start and stop containers using the KafkaListenerEndpointRegistry bean; set autoStartup to false on the container factory.

See Detecting Idle and Non-Responsive Consumers.

While efficient, one problem with asynchronous consumers is detecting when they are idle - users might want to take some action if no messages arrive for some period of time.

You can configure the listener container to publish a ListenerContainerIdleEvent when some time passes with no message delivery. While the container is idle, an event will be published every idleEventInterval milliseconds.

...



来源:https://stackoverflow.com/questions/60656704/how-to-find-no-more-messages-in-kafka-topic-partition-reading-only-after-writi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!