Skip to content

Commit

Permalink
chore(test): fix falling test
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Jan 5, 2022
1 parent 7e99277 commit 190f137
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/org/akhq/repositories/RecordRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public class RecordRepository extends AbstractRepository {
@Value("${akhq.clients-defaults.consumer.properties.max.poll.records:50}")
protected int maxPollRecords;

@Value("${akhq.topic-data.kafka-max-message-length}")
private int maxKafkaMessageLength;
@Value("${akhq.topic-data.kafka-max-message-length:2147483647}")
protected int maxKafkaMessageLength;

public Map<String, Record> getLastRecord(String clusterId, List<String> topicsName) throws ExecutionException, InterruptedException {
Map<String, Topic> topics = topicRepository.findByName(clusterId, topicsName).stream()
Expand Down Expand Up @@ -1276,6 +1276,10 @@ private static class EndOffsetBound {
}

private void filterMessageLength(Record record) {
if (maxKafkaMessageLength == Integer.MAX_VALUE) {
return;
}

int bytesLength = record.getValue().getBytes(StandardCharsets.UTF_8).length;
if (bytesLength > maxKafkaMessageLength) {
int substringChars = maxKafkaMessageLength / 1000;
Expand Down

0 comments on commit 190f137

Please sign in to comment.