@@ -1524,6 +1524,7 @@ private ConsumerRecords<byte[], byte[]> pollRequests(final Duration pollTime) {
1524
1524
try {
1525
1525
records = mainConsumer .poll (pollTime );
1526
1526
} catch (final InvalidOffsetException e ) {
1527
+ log .info ("Found no valid offset for {} partitions, resetting." , e .partitions ().size ());
1527
1528
resetOffsets (e .partitions (), e );
1528
1529
}
1529
1530
@@ -1598,22 +1599,22 @@ private void resetOffsets(final Set<TopicPartition> partitions, final Exception
1598
1599
addToResetList (
1599
1600
partition ,
1600
1601
seekToBeginning ,
1601
- "Setting topic '{}' to consume from earliest offset" ,
1602
+ "Setting topic '{}' to consume from ' earliest' offset" ,
1602
1603
loggedTopics
1603
1604
);
1604
1605
} else if (resetPolicy == AutoOffsetResetStrategy .LATEST ) {
1605
1606
addToResetList (
1606
1607
partition ,
1607
1608
seekToEnd ,
1608
- "Setting topic '{}' to consume from latest offset" ,
1609
+ "Setting topic '{}' to consume from ' latest' offset" ,
1609
1610
loggedTopics
1610
1611
);
1611
1612
} else if (resetPolicy .type () == AutoOffsetResetStrategy .StrategyType .BY_DURATION ) {
1612
1613
addToResetList (
1613
1614
partition ,
1614
1615
seekByDuration ,
1615
1616
resetPolicy .duration ().get (),
1616
- "Setting topic '{}' to consume from by_duration:{}" ,
1617
+ "Setting topic '{}' to consume from ' by_duration:{}' " ,
1617
1618
resetPolicy .duration ().get ().toString (),
1618
1619
loggedTopics
1619
1620
);
@@ -1729,12 +1730,12 @@ private void resetOffsets(final Set<TopicPartition> partitions, final Exception
1729
1730
private void addToResetList (
1730
1731
final TopicPartition partition ,
1731
1732
final Set <TopicPartition > partitions ,
1732
- final String resetPolicy ,
1733
+ final String logMessage ,
1733
1734
final Set <String > loggedTopics
1734
1735
) {
1735
1736
final String topic = partition .topic ();
1736
1737
if (loggedTopics .add (topic )) {
1737
- log .info ("Setting topic '{}' to consume from {} offset" , topic , resetPolicy );
1738
+ log .info (logMessage , topic );
1738
1739
}
1739
1740
partitions .add (partition );
1740
1741
}
0 commit comments