@@ -1532,6 +1532,7 @@ private ConsumerRecords<byte[], byte[]> pollRequests(final Duration pollTime) {
1532
1532
try {
1533
1533
records = mainConsumer .poll (pollTime );
1534
1534
} catch (final InvalidOffsetException e ) {
1535
+ log .info ("Found no valid offset for {} partitions, resetting." , e .partitions ().size ());
1535
1536
resetOffsets (e .partitions (), e );
1536
1537
}
1537
1538
@@ -1647,22 +1648,22 @@ private void resetOffsets(final Set<TopicPartition> partitions, final Exception
1647
1648
addToResetList (
1648
1649
partition ,
1649
1650
seekToBeginning ,
1650
- "Setting topic '{}' to consume from earliest offset" ,
1651
+ "Setting topic '{}' to consume from ' earliest' offset" ,
1651
1652
loggedTopics
1652
1653
);
1653
1654
} else if (resetPolicy == AutoOffsetResetStrategy .LATEST ) {
1654
1655
addToResetList (
1655
1656
partition ,
1656
1657
seekToEnd ,
1657
- "Setting topic '{}' to consume from latest offset" ,
1658
+ "Setting topic '{}' to consume from ' latest' offset" ,
1658
1659
loggedTopics
1659
1660
);
1660
1661
} else if (resetPolicy .type () == AutoOffsetResetStrategy .StrategyType .BY_DURATION ) {
1661
1662
addToResetList (
1662
1663
partition ,
1663
1664
seekByDuration ,
1664
1665
resetPolicy .duration ().get (),
1665
- "Setting topic '{}' to consume from by_duration:{}" ,
1666
+ "Setting topic '{}' to consume from ' by_duration:{}' " ,
1666
1667
resetPolicy .duration ().get ().toString (),
1667
1668
loggedTopics
1668
1669
);
@@ -1778,12 +1779,12 @@ private void resetOffsets(final Set<TopicPartition> partitions, final Exception
1778
1779
private void addToResetList (
1779
1780
final TopicPartition partition ,
1780
1781
final Set <TopicPartition > partitions ,
1781
- final String resetPolicy ,
1782
+ final String logMessage ,
1782
1783
final Set <String > loggedTopics
1783
1784
) {
1784
1785
final String topic = partition .topic ();
1785
1786
if (loggedTopics .add (topic )) {
1786
- log .info ("Setting topic '{}' to consume from {} offset" , topic , resetPolicy );
1787
+ log .info (logMessage , topic );
1787
1788
}
1788
1789
partitions .add (partition );
1789
1790
}
0 commit comments