Skip to content

Commit

Permalink
Non-Responsive Consumer Doc Polishing
Browse files Browse the repository at this point in the history
This was a problem with early versions of the clients; the code
remains in case some other reason causes the poll to hang.
Clarify the docs.
  • Loading branch information
garyrussell committed Feb 14, 2022
1 parent 93d6089 commit 4753512
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions spring-kafka-docs/src/main/asciidoc/kafka.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -2928,8 +2928,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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -25,8 +25,8 @@
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
Expand Down

0 comments on commit 4753512

Please sign in to comment.