in remoting/src/main/java/org/apache/rocketmq/remoting/protocol/body/ConsumerRunningInfo.java [204:345]
public String formatString() {
StringBuilder sb = new StringBuilder();
{
sb.append("#Consumer Properties#\n");
Iterator<Entry<Object, Object>> it = this.properties.entrySet().iterator();
while (it.hasNext()) {
Entry<Object, Object> next = it.next();
String item = String.format("%-40s: %s%n", next.getKey().toString(), next.getValue().toString());
sb.append(item);
}
}
{
sb.append("\n\n#Consumer Subscription#\n");
Iterator<SubscriptionData> it = this.subscriptionSet.iterator();
int i = 0;
while (it.hasNext()) {
SubscriptionData next = it.next();
String item = String.format("%03d Topic: %-40s ClassFilter: %-8s SubExpression: %s%n",
++i,
next.getTopic(),
next.isClassFilterMode(),
next.getSubString());
sb.append(item);
}
}
{
sb.append("\n\n#Consumer Offset#\n");
sb.append(String.format("%-64s %-32s %-4s %-20s%n",
"#Topic",
"#Broker Name",
"#QID",
"#Consumer Offset"
));
Iterator<Entry<MessageQueue, ProcessQueueInfo>> it = this.mqTable.entrySet().iterator();
while (it.hasNext()) {
Entry<MessageQueue, ProcessQueueInfo> next = it.next();
String item = String.format("%-32s %-32s %-4d %-20d%n",
next.getKey().getTopic(),
next.getKey().getBrokerName(),
next.getKey().getQueueId(),
next.getValue().getCommitOffset());
sb.append(item);
}
}
{
sb.append("\n\n#Consumer MQ Detail#\n");
sb.append(String.format("%-64s %-32s %-4s %-20s%n",
"#Topic",
"#Broker Name",
"#QID",
"#ProcessQueueInfo"
));
Iterator<Entry<MessageQueue, ProcessQueueInfo>> it = this.mqTable.entrySet().iterator();
while (it.hasNext()) {
Entry<MessageQueue, ProcessQueueInfo> next = it.next();
String item = String.format("%-64s %-32s %-4d %s%n",
next.getKey().getTopic(),
next.getKey().getBrokerName(),
next.getKey().getQueueId(),
next.getValue().toString());
sb.append(item);
}
}
{
sb.append("\n\n#Consumer Pop Detail#\n");
sb.append(String.format("%-32s %-32s %-4s %-20s%n",
"#Topic",
"#Broker Name",
"#QID",
"#ProcessQueueInfo"
));
Iterator<Entry<MessageQueue, PopProcessQueueInfo>> it = this.mqPopTable.entrySet().iterator();
while (it.hasNext()) {
Entry<MessageQueue, PopProcessQueueInfo> next = it.next();
String item = String.format("%-32s %-32s %-4d %s%n",
next.getKey().getTopic(),
next.getKey().getBrokerName(),
next.getKey().getQueueId(),
next.getValue().toString());
sb.append(item);
}
}
{
sb.append("\n\n#Consumer RT&TPS#\n");
sb.append(String.format("%-64s %14s %14s %14s %14s %18s %25s%n",
"#Topic",
"#Pull RT",
"#Pull TPS",
"#Consume RT",
"#ConsumeOK TPS",
"#ConsumeFailed TPS",
"#ConsumeFailedMsgsInHour"
));
Iterator<Entry<String, ConsumeStatus>> it = this.statusTable.entrySet().iterator();
while (it.hasNext()) {
Entry<String, ConsumeStatus> next = it.next();
String item = String.format("%-32s %14.2f %14.2f %14.2f %14.2f %18.2f %25d%n",
next.getKey(),
next.getValue().getPullRT(),
next.getValue().getPullTPS(),
next.getValue().getConsumeRT(),
next.getValue().getConsumeOKTPS(),
next.getValue().getConsumeFailedTPS(),
next.getValue().getConsumeFailedMsgs()
);
sb.append(item);
}
}
if (this.userConsumerInfo != null) {
sb.append("\n\n#User Consume Info#\n");
Iterator<Entry<String, String>> it = this.userConsumerInfo.entrySet().iterator();
while (it.hasNext()) {
Entry<String, String> next = it.next();
String item = String.format("%-40s: %s%n", next.getKey(), next.getValue());
sb.append(item);
}
}
if (this.jstack != null) {
sb.append("\n\n#Consumer jstack#\n");
sb.append(this.jstack);
}
return sb.toString();
}