Skip to content

Commit 03a8937

Browse files
s50600822wilkinsona
authored andcommitted
Add a configuration property for KLC's idleBetweenPolls
See gh-23048
1 parent 56ded38 commit 03a8937

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/ConcurrentKafkaListenerContainerFactoryConfigurer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ private void configureContainer(ContainerProperties container) {
187187
map.from(properties::getIdleEventInterval).as(Duration::toMillis).to(container::setIdleEventInterval);
188188
map.from(properties::getMonitorInterval).as(Duration::getSeconds).as(Number::intValue)
189189
.to(container::setMonitorInterval);
190+
map.from(properties.getIdleBetweenPolls()).as(Duration::toMillis).to(container::setIdleBetweenPolls);
190191
map.from(properties::getLogContainerConfig).to(container::setLogContainerConfig);
191192
map.from(properties::isMissingTopicsFatal).to(container::setMissingTopicsFatal);
192193
map.from(this.transactionManager).to(container::setTransactionManager);

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/kafka/KafkaProperties.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,12 @@ public enum Type {
890890
*/
891891
private Duration idleEventInterval;
892892

893+
/**
894+
* The sleep interval in milliseconds between
895+
* {@link org.apache.kafka.clients.consumer.Consumer#poll(Duration)} calls.
896+
*/
897+
private Duration idleBetweenPolls;
898+
893899
/**
894900
* Time between checks for non-responsive consumers. If a duration suffix is not
895901
* specified, seconds will be used.
@@ -980,6 +986,14 @@ public void setIdleEventInterval(Duration idleEventInterval) {
980986
this.idleEventInterval = idleEventInterval;
981987
}
982988

989+
public Duration getIdleBetweenPolls() {
990+
return idleBetweenPolls;
991+
}
992+
993+
public void setIdleBetweenPolls(Duration idleBetweenPolls) {
994+
this.idleBetweenPolls = idleBetweenPolls;
995+
}
996+
983997
public Duration getMonitorInterval() {
984998
return this.monitorInterval;
985999
}
@@ -1003,7 +1017,6 @@ public boolean isMissingTopicsFatal() {
10031017
public void setMissingTopicsFatal(boolean missingTopicsFatal) {
10041018
this.missingTopicsFatal = missingTopicsFatal;
10051019
}
1006-
10071020
}
10081021

10091022
public static class Ssl {

0 commit comments

Comments
 (0)