Skip to content

Commit 343df6d

Browse files
hosuabygaryrussell
authored andcommitted
FIX: KafkaMessageListenerContainer#processTimestampSeeks offsetsForTimes method can return map with null values
1 parent 7a0180e commit 343df6d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

spring-kafka/src/main/java/org/springframework/kafka/listener/KafkaMessageListenerContainer.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2008,7 +2008,13 @@ private void processTimestampSeeks() {
20082008
if (timestampSeeks != null) {
20092009
Map<TopicPartition, OffsetAndTimestamp> offsetsForTimes = this.consumer
20102010
.offsetsForTimes(timestampSeeks);
2011-
offsetsForTimes.forEach((tp, ot) -> this.consumer.seek(tp, ot.offset()));
2011+
2012+
for (TopicPartition tp : offsetsForTimes.keySet()) {
2013+
OffsetAndTimestamp ot = offsetsForTimes.get(tp);
2014+
if (ot != null) {
2015+
this.consumer.seek(tp, ot.offset());
2016+
}
2017+
}
20122018
}
20132019
}
20142020

0 commit comments

Comments
 (0)