Upgrade to spring-kafka 2.6.0
This commit is contained in:
@@ -101,6 +101,8 @@ public class KafkaMessageSource<K, V> extends AbstractMessageSource<Object> impl
|
||||
|
||||
private static final long MIN_ASSIGN_TIMEOUT = 2000L;
|
||||
|
||||
private static int DEFAULT_CLOSE_TIMEOUT = 30;
|
||||
|
||||
/**
|
||||
* The number of records remaining from the previous poll.
|
||||
* @since 3.2
|
||||
@@ -135,6 +137,8 @@ public class KafkaMessageSource<K, V> extends AbstractMessageSource<Object> impl
|
||||
|
||||
private boolean running;
|
||||
|
||||
private Duration closeTimeout = Duration.ofSeconds(DEFAULT_CLOSE_TIMEOUT);
|
||||
|
||||
private volatile Consumer<K, V> consumer;
|
||||
|
||||
private volatile boolean pausing;
|
||||
@@ -334,6 +338,15 @@ public class KafkaMessageSource<K, V> extends AbstractMessageSource<Object> impl
|
||||
return this.commitTimeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the close timeout - default 30 seconds.
|
||||
* @param closeTimeout the close timeout.
|
||||
*/
|
||||
public void setCloseTimeout(Duration closeTimeout) {
|
||||
Assert.notNull(closeTimeout, "'closeTimeout' cannot be null");
|
||||
this.closeTimeout = closeTimeout;
|
||||
}
|
||||
|
||||
private ConsumerFactory<K, V> fixOrRejectConsumerFactory(ConsumerFactory<K, V> suppliedConsumerFactory,
|
||||
boolean allowMultiFetch) {
|
||||
|
||||
@@ -571,7 +584,7 @@ public class KafkaMessageSource<K, V> extends AbstractMessageSource<Object> impl
|
||||
private void stopConsumer() {
|
||||
synchronized (this.consumerMonitor) {
|
||||
if (this.consumer != null) {
|
||||
this.consumer.close();
|
||||
this.consumer.close(this.closeTimeout);
|
||||
this.consumer = null;
|
||||
this.assignedPartitions.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user