Skip to content

Commit

Permalink
feat(topic-data): sort topic records by timestamp (#337)
Browse files Browse the repository at this point in the history
Co-authored-by: Raj Kumar Mondol <rajkumar.mondol@tesco.com>
  • Loading branch information
RajKumarMondol and Raj Kumar Mondol committed Aug 7, 2020
1 parent 840fcd3 commit 00bf22a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/akhq/repositories/RecordRepository.java
Expand Up @@ -89,6 +89,8 @@ private List<Record> consumeOldest(Topic topic, Options options) {

consumer.close();

list.sort(Comparator.comparing(Record::getTimestamp));

return list;
}

Expand Down Expand Up @@ -227,6 +229,7 @@ private List<Record> consumeNewest(Topic topic, Options options) {
return Stream.of(list);
})
.flatMap(List::stream)
.sorted(Comparator.comparing(Record::getTimestamp).reversed())
.collect(Collectors.toList());
}

Expand Down

0 comments on commit 00bf22a

Please sign in to comment.