问题
I'm using Spring boot version 1.5.4.RELEASE & spring Kafka version 1.3.8.RELEASE.
Some generic questions
- is there way to find out no more messages in topic/partition in consumer
- 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 everyidleEventInterval
milliseconds....
来源:https://stackoverflow.com/questions/60656704/how-to-find-no-more-messages-in-kafka-topic-partition-reading-only-after-writi