Skip to content

Commit

Permalink
[ISSUE #4002]Optimize some mqadmin command execution results output (#…
Browse files Browse the repository at this point in the history
…4003)

Co-authored-by: zhangjidi <zhangjidi@cmss.chinamobile.com>
  • Loading branch information
zhangjidi2016 and zhangjidi committed Mar 22, 2022
1 parent e283dcc commit f57ea77
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) t
int i = 1;
long now = System.currentTimeMillis();
final TreeMap<String/* clientId */, ConsumerRunningInfo> criTable = new TreeMap<String, ConsumerRunningInfo>();
System.out.printf("%-10s %-40s %-20s %s%n",
"#Index",
"#ClientId",
"#Version",
"#ConsumerRunningInfoFile");
for (Connection conn : cc.getConnectionSet()) {
try {
ConsumerRunningInfo consumerRunningInfo =
Expand All @@ -96,7 +101,7 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) t
criTable.put(conn.getClientId(), consumerRunningInfo);
String filePath = now + "/" + conn.getClientId();
MixAll.string2FileNotSafe(consumerRunningInfo.formatString(), filePath);
System.out.printf("%03d %-40s %-20s %s%n",
System.out.printf("%-10d %-40s %-20s %s%n",
i++,
conn.getClientId(),
MQVersion.getVersionDesc(conn.getVersion()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) t
maxOffset = consumer.searchOffset(mq, timeValue);
}

System.out.printf("minOffset=%s, maxOffset=%s, %s", minOffset, maxOffset, mq);
System.out.printf("minOffset=%s, maxOffset=%s, %s%n", minOffset, maxOffset, mq);

READQ:
for (long offset = minOffset; offset < maxOffset; ) {
Expand All @@ -146,18 +146,19 @@ public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) t
printMessage(pullResult.getMsgFoundList(), charsetName, printBody);
break;
case NO_MATCHED_MSG:
System.out.printf("%s no matched msg. status=%s, offset=%s", mq, pullResult.getPullStatus(), offset);
System.out.printf("%s no matched msg. status=%s, offset=%s%n", mq, pullResult.getPullStatus(), offset);
break;
case NO_NEW_MSG:
case OFFSET_ILLEGAL:
System.out.printf("%s print msg finished. status=%s, offset=%s", mq, pullResult.getPullStatus(), offset);
System.out.printf("%s print msg finished. status=%s, offset=%s%n", mq, pullResult.getPullStatus(), offset);
break READQ;
}
} catch (Exception e) {
e.printStackTrace();
break;
}
}
System.out.printf("--------------------------------------------------------\n");
}

} catch (Exception e) {
Expand Down

0 comments on commit f57ea77

Please sign in to comment.