diff --git a/spring-kafka-docs/src/main/asciidoc/kafka.adoc b/spring-kafka-docs/src/main/asciidoc/kafka.adoc index f0da2e67..78335217 100644 --- a/spring-kafka-docs/src/main/asciidoc/kafka.adoc +++ b/spring-kafka-docs/src/main/asciidoc/kafka.adoc @@ -2875,8 +2875,8 @@ public ConcurrentKafkaListenerContainerFactory kafkaListenerContainerFactory() { In each of these cases, an event is published once per minute while the container is idle. -In addition, if the broker is unreachable, the consumer `poll()` method does not exit, so no messages are received and idle events cannot be generated. -To solve this issue, the container publishes a `NonResponsiveConsumerEvent` if a poll does not return within `3x` the `pollTimeout` property. +If, for some reason, the consumer `poll()` method does not exit, no messages are received and idle events cannot be generated (this was a problem with early versions of the `kafka-clients` when the broker wasn't reachable). +In this case, the container publishes a `NonResponsiveConsumerEvent` if a poll does not return within `3x` the `pollTimeout` property. By default, this check is performed once every 30 seconds in each container. You can modify this behavior by setting the `monitorInterval` (default 30 seconds) and `noPollThreshold` (default 3.0) properties in the `ContainerProperties` when configuring the listener container. The `noPollThreshold` should be greater than `1.0` to avoid getting spurious events due to a race condition. diff --git a/spring-kafka/src/main/java/org/springframework/kafka/event/NonResponsiveConsumerEvent.java b/spring-kafka/src/main/java/org/springframework/kafka/event/NonResponsiveConsumerEvent.java index e9e1b134..fff478a2 100644 --- a/spring-kafka/src/main/java/org/springframework/kafka/event/NonResponsiveConsumerEvent.java +++ b/spring-kafka/src/main/java/org/springframework/kafka/event/NonResponsiveConsumerEvent.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2020 the original author or authors. + * Copyright 2017-2022 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,8 +25,8 @@ import org.apache.kafka.clients.consumer.Consumer; import org.apache.kafka.common.TopicPartition; /** - * An event that is emitted when a consumer is not responding to - * the poll; a possible indication that the broker is down. + * An event that is emitted when a consumer is not responding to the poll; with early + * versions of the kafka-clients, this was a possible indication that the broker is down. * * @author Gary Russell * @since 1.3.1