Skip to content

Commit

Permalink
[improve][cli] CmdConsume print publishTime And eventTime info. (apac…
Browse files Browse the repository at this point in the history
…he#22308)

Co-authored-by: atomchchen <[email protected]>
  • Loading branch information
chenhongSZ and chenhongSZ authored Mar 21, 2024
1 parent 71598c1 commit 74585b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ protected String interpretMessage(Message<?> message, boolean displayHex) throws
data = value.toString();
}

sb.append("publishTime:[").append(message.getPublishTime()).append("], ");
sb.append("eventTime:[").append(message.getEventTime()).append("], ");

String key = null;
if (message.hasKey()) {
key = message.getKey();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,14 @@ private List<String> consume(ChaosContainer<?> container, String url, String top
+ "\nError output:\n" + result.getStderr());
}
String output = result.getStdout();
Pattern message = Pattern.compile("----- got message -----\nkey:\\[null\\], properties:\\[\\], content:(.*)");
Pattern message = Pattern.compile(
"----- got message -----\npublishTime:\\[(.*)\\], eventTime:\\[(.*)\\], key:\\[null\\], "
+ "properties:\\[\\], content:(.*)");
Matcher matcher = message.matcher(output);
List<String> received = new ArrayList<>(MESSAGE_COUNT);
while (matcher.find()) {
received.add(matcher.group(1));
received.add(matcher.group(3));
}
return received;
}

}

0 comments on commit 74585b5

Please sign in to comment.