}
public static void queryById(final DefaultMQAdminExt admin, final String msgId) throws MQClientException,
RemotingException, MQBrokerException, InterruptedException, IOException {
MessageExt msg = admin.viewMessage(msgId);
// 存储消息 body 到指定路径
String bodyTmpFilePath = createBodyFile(msg);
System.out.printf("%-20s %s\n",//
"Topic:",//
msg.getTopic()//
);
System.out.printf("%-20s %s\n",//
"Tags:",//
"[" + msg.getTags() + "]"//
);
System.out.printf("%-20s %s\n",//
"Keys:",//
"[" + msg.getKeys() + "]"//
);
System.out.printf("%-20s %d\n",//
"Queue ID:",//
msg.getQueueId()//
);
System.out.printf("%-20s %d\n",//
"Queue Offset:",//
msg.getQueueOffset()//
);
System.out.printf("%-20s %d\n",//
"CommitLog Offset:",//
msg.getCommitLogOffset()//
);
System.out.printf("%-20s %d\n",//
"Reconsume Times:",//
msg.getReconsumeTimes()//
);
System.out.printf("%-20s %s\n",//
"Born Timestamp:",//
UtilAll.timeMillisToHumanString2(msg.getBornTimestamp())//
);
System.out.printf("%-20s %s\n",//
"Store Timestamp:",//
UtilAll.timeMillisToHumanString2(msg.getStoreTimestamp())//
);
System.out.printf("%-20s %s\n",//
"Born Host:",//
RemotingHelper.parseSocketAddressAddr(msg.getBornHost())//
);
System.out.printf("%-20s %s\n",//
"Store Host:",//
RemotingHelper.parseSocketAddressAddr(msg.getStoreHost())//
);
System.out.printf("%-20s %d\n",//
"System Flag:",//
msg.getSysFlag()//
);
System.out.printf("%-20s %s\n",//
"Properties:",//
msg.getProperties() != null ? msg.getProperties().toString() : ""//
);
System.out.printf("%-20s %s\n",//
"Message Body Path:",//
bodyTmpFilePath//