Non-Responsive Consumer Doc Polishing

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.
This commit is contained in:
Gary Russell
2022-02-14 12:40:12 -05:00
parent b8670e8fc1
commit ea9601e478
2 changed files with 5 additions and 5 deletions

View File

@@ -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.

View File

@@ -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