提交 c34796bd 编写于 作者: 斜阳

[ISSUE #2735] QueryMsgByUniqueKey tool should return all messages with same unique key

上级 672f5819
......@@ -134,7 +134,7 @@ public class DefaultMQAdminExt extends ClientConfig implements MQAdminExt {
return defaultMQAdminExtImpl.queryMessage(topic, key, maxNum, begin, end);
}
public QueryResult queryMessageByUniqueKey(String topic, String key, int maxNum, long begin, long end)
public QueryResult queryMessageByUniqKey(String topic, String key, int maxNum, long begin, long end)
throws MQClientException, InterruptedException {
return defaultMQAdminExtImpl.queryMessageByUniqKey(topic, key, maxNum, begin, end);
......
......@@ -62,9 +62,12 @@ public class QueryMsgByUniqueKeySubCommand implements SubCommand {
final boolean showAll) throws MQClientException,
RemotingException, MQBrokerException, InterruptedException, IOException {
QueryResult queryResult = admin.queryMessageByUniqueKey(topic, msgId, 32, 0, Long.MAX_VALUE);
QueryResult queryResult = admin.queryMessageByUniqKey(topic, msgId, 32, 0, Long.MAX_VALUE);
assert queryResult != null;
List<MessageExt> list = queryResult.getMessageList();
if (list == null || list.size() == 0) {
return;
}
list.sort((o1, o2) -> (int) (o1.getStoreTimestamp() - o2.getStoreTimestamp()));
for (int i = 0; i < (showAll ? list.size() : 1); i++) {
showMessage(admin, list.get(i), i);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册