0

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?
Nagendra Busam
  • 235
  • 1
  • 5
  • 19

1 Answers1

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.

...

Community
  • 1
  • 1
Gary Russell
  • 166,535
  • 14
  • 146
  • 179
  • How can I perform certain custom action when ListenerContainerIdleEvent occurs? If I am not wrong, If I have 10 instances of consumer - each consumer will get this event ( if configured) when partition(s) connected have no messages for consumption in listener – Nagendra Busam Mar 12 '20 at 15:51
  • 1
    That is correct; you will need to wait until all the partitions have been reported by idle containers. – Gary Russell Mar 12 '20 at 15:53
  • To perform custom action, I need to do something like below https://docs.spring.io/spring-kafka/docs/1.3.10.RELEASE/reference/html/_reference.html#_event_consumption – Nagendra Busam Mar 12 '20 at 16:20