diff --git a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/inbound/KafkaMessageSource.java b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/inbound/KafkaMessageSource.java index 9a3da386bb..5f90e6adc3 100644 --- a/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/inbound/KafkaMessageSource.java +++ b/spring-integration-kafka/src/main/java/org/springframework/integration/kafka/inbound/KafkaMessageSource.java @@ -70,6 +70,11 @@ import org.springframework.util.Assert; * from the subsequent offsets will be redelivered - even if they were * processed successfully. Applications should therefore implement * idempotency. + *

+ * Starting with version 2.2.5, this source implements {@link Pausable} which + * allows you to pause and resume the {@link Consumer}. While the consumer is + * paused, you must continue to call {@link #receive()} within + * {@code max.poll.interval.ms}, to prevent a rebalance. * * @param the key type. * @param the value type. @@ -300,11 +305,19 @@ public class KafkaMessageSource extends AbstractMessageSource impl this.running = false; } + /** + * {@inheritDoc} + * @since 3.1.2 + */ @Override public synchronized void pause() { this.pausing = true; } + /** + * {@inheritDoc} + * @since 3.1.2 + */ @Override public synchronized void resume() { this.pausing = false; @@ -324,7 +337,7 @@ public class KafkaMessageSource extends AbstractMessageSource impl this.consumer.resume(this.assignedPartitions); this.paused = false; } - if (this.paused && this.logger.isDebugEnabled()) { + if (this.paused) { this.logger.debug("Consumer is paused; no records will be returned"); } ConsumerRecord record;