Java Code Examples for org.apache.rocketmq.tools.admin.DefaultMQAdminExt#messageTrackDetail()

The following examples show how to use org.apache.rocketmq.tools.admin.DefaultMQAdminExt#messageTrackDetail() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: QueryMsgByUniqueKeySubCommand.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
public static void queryById(final DefaultMQAdminExt admin, final String topic,
    final String msgId) throws MQClientException,
    RemotingException, MQBrokerException, InterruptedException, IOException {
    MessageExt msg = admin.viewMessage(topic, msgId, true);

    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
    );

    try {
        List<MessageTrack> mtdList = admin.messageTrackDetail(msg);
        if (mtdList.isEmpty()) {
            System.out.printf("%n%nWARN: No Consumer");
        } else {
            System.out.printf("%n%n");
            for (MessageTrack mt : mtdList) {
                System.out.printf("%s", mt);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq-4.3.0 with Apache License 2.0 4 votes vote down vote up
public static void queryById(final DefaultMQAdminExt admin, final String topic,
    final String msgId) throws MQClientException,
    RemotingException, MQBrokerException, InterruptedException, IOException {
    MessageExt msg = admin.viewMessage(topic, msgId);

    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
    );

    try {
        List<MessageTrack> mtdList = admin.messageTrackDetail(msg);
        if (mtdList.isEmpty()) {
            System.out.printf("%n%nWARN: No Consumer");
        } else {
            System.out.printf("%n%n");
            for (MessageTrack mt : mtdList) {
                System.out.printf("%s", mt);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 3
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq-read with Apache License 2.0 4 votes vote down vote up
public static void queryById(final DefaultMQAdminExt admin, final String topic,
    final String msgId) throws MQClientException,
    RemotingException, MQBrokerException, InterruptedException, IOException {
    MessageExt msg = admin.viewMessage(topic, msgId);

    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
    );

    try {
        List<MessageTrack> mtdList = admin.messageTrackDetail(msg);
        if (mtdList.isEmpty()) {
            System.out.printf("%n%nWARN: No Consumer");
        } else {
            System.out.printf("%n%n");
            for (MessageTrack mt : mtdList) {
                System.out.printf("%s", mt);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 4
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public static void queryById(final DefaultMQAdminExt admin, final String topic, final String msgId) throws MQClientException,
    RemotingException, MQBrokerException, InterruptedException, IOException {
    MessageExt msg = admin.viewMessage(topic, msgId);

    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
    );

    try {
        List<MessageTrack> mtdList = admin.messageTrackDetail(msg);
        if (mtdList.isEmpty()) {
            System.out.printf("%n%nWARN: No Consumer");
        } else {
            System.out.printf("%n%n");
            for (MessageTrack mt : mtdList) {
                System.out.printf("%s", mt);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 5
Source File: QueryMsgByUniqueKeySubCommand.java    From DDMQ with Apache License 2.0 4 votes vote down vote up
public static void queryById(final DefaultMQAdminExt admin, final String topic,
    final String msgId) throws MQClientException,
    RemotingException, MQBrokerException, InterruptedException, IOException {
    MessageExt msg = admin.viewMessage(topic, msgId, true);

    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
    );

    try {
        List<MessageTrack> mtdList = admin.messageTrackDetail(msg);
        if (mtdList.isEmpty()) {
            System.out.printf("%n%nWARN: No Consumer");
        } else {
            System.out.printf("%n%n");
            for (MessageTrack mt : mtdList) {
                System.out.printf("%s", mt);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 6
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq-all-4.1.0-incubating with Apache License 2.0 4 votes vote down vote up
public static void queryById(final DefaultMQAdminExt admin, final String topic, final String msgId) throws MQClientException,
    RemotingException, MQBrokerException, InterruptedException, IOException {
    MessageExt msg = admin.viewMessage(topic, msgId);

    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
    );

    try {
        List<MessageTrack> mtdList = admin.messageTrackDetail(msg);
        if (mtdList.isEmpty()) {
            System.out.printf("%n%nWARN: No Consumer");
        } else {
            System.out.printf("%n%n");
            for (MessageTrack mt : mtdList) {
                System.out.printf("%s", mt);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 7
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq_trans_message with Apache License 2.0 4 votes vote down vote up
public static void queryById(final DefaultMQAdminExt admin, final String topic, final String msgId) throws MQClientException,
    RemotingException, MQBrokerException, InterruptedException, IOException {
    MessageExt msg = admin.viewMessage(topic, msgId);

    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
    );

    try {
        List<MessageTrack> mtdList = admin.messageTrackDetail(msg);
        if (mtdList.isEmpty()) {
            System.out.printf("%n%nWARN: No Consumer");
        } else {
            System.out.printf("%n%n");
            for (MessageTrack mt : mtdList) {
                System.out.printf("%s", mt);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 8
Source File: QueryMsgByIdSubCommand.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public static void printMsg(final DefaultMQAdminExt admin, final MessageExt msg) throws IOException {
    if (msg == null) {
        System.out.printf("%nMessage not found!");
        return;
    }

    String bodyTmpFilePath = createBodyFile(msg);
    String msgId = msg.getMsgId();
    if (msg instanceof MessageClientExt) {
        msgId = ((MessageClientExt) msg).getOffsetMsgId();
    }

    System.out.printf("%-20s %s%n",
        "OffsetID:",
        msgId
    );

    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
    );

    try {
        List<MessageTrack> mtdList = admin.messageTrackDetail(msg);
        if (mtdList.isEmpty()) {
            System.out.printf("%n%nWARN: No Consumer");
        } else {
            System.out.printf("%n%n");
            for (MessageTrack mt : mtdList) {
                System.out.printf("%s", mt);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example 9
Source File: QueryMsgByUniqueKeySubCommand.java    From rocketmq with Apache License 2.0 4 votes vote down vote up
public static void queryById(final DefaultMQAdminExt admin, final String topic,
    final String msgId) throws MQClientException,
    RemotingException, MQBrokerException, InterruptedException, IOException {
    MessageExt msg = admin.viewMessage(topic, msgId);

    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
    );

    try {
        List<MessageTrack> mtdList = admin.messageTrackDetail(msg);
        if (mtdList.isEmpty()) {
            System.out.printf("%n%nWARN: No Consumer");
        } else {
            System.out.printf("%n%n");
            for (MessageTrack mt : mtdList) {
                System.out.printf("%s", mt);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}