Skip to content

Commit f1f687b

Browse files
hosuabygaryrussell
authored andcommitted
FIX: KafkaMessageListenerContainer#processTimestampSeeks offsetsForTimes method can return map with null values
1 parent 2358c63 commit f1f687b

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
@@ -2005,7 +2005,13 @@ private void processTimestampSeeks() {
20052005
if (timestampSeeks != null) {
20062006
Map<TopicPartition, OffsetAndTimestamp> offsetsForTimes = this.consumer
20072007
.offsetsForTimes(timestampSeeks);
2008-
offsetsForTimes.forEach((tp, ot) -> this.consumer.seek(tp, ot.offset()));
2008+
2009+
for (TopicPartition tp : offsetsForTimes.keySet()) {
2010+
OffsetAndTimestamp ot = offsetsForTimes.get(tp);
2011+
if (ot != null) {
2012+
this.consumer.seek(tp, ot.offset());
2013+
}
2014+
}
20092015
}
20102016
}
20112017

0 commit comments

Comments
 (0)