Skip to content

Commit

Permalink
feat: add partitions to PRINT TOPIC output
Browse files Browse the repository at this point in the history
  • Loading branch information
agavra committed Nov 19, 2020
1 parent 976c852 commit a77316a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ private List<String> formatRecords(final Iterable<ConsumerRecord<Bytes, Bytes>>
private String formatRecord(final ConsumerRecord<Bytes, Bytes> record) {
return "rowtime: " + formatRowTime(record.timestamp())
+ ", " + "key: " + keyDeserializers.format(record.key())
+ ", value: " + valueDeserializers.format(record.value());
+ ", value: " + valueDeserializers.format(record.value())
+ ", partition: " + record.partition();
}

private static String formatRowTime(final long timestamp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,15 @@ public void shouldFormatRowTime() {
assertThat(formatted, containsString("rowtime: 2020/05/01 14:45:13.111 Z, "));
}

@Test
public void shouldFormatPartition() {
// When:
final String formatted = formatSingle(consumerRecord(null, null));

// Then:
assertThat(formatted, containsString("partition: 1"));
}

@Test
public void shouldFormatNoRowTime() {
// Given:
Expand Down

0 comments on commit a77316a

Please sign in to comment.