tencent cloud

Feedback

Message Trace Description

Last updated: 2024-01-17 16:42:18
    A message trace records the entire process of a message from the producer to the TDMQ for RocketMQ server, and ultimately to the consumer, enumerating elements such as the time spent in each stage (accurate to the microsecond), execution outcome, producer IP, and consumer IP.

    Prerequisites

    You have deployed the producer and consumer services as instructed in the SDK documentation, and there are messages produced and consumed in the last three days.
    If you are producing and consuming messages using a client 5.0 or later, there is no need to separately turn on the trace switch on the client.
    If you are using a client 4.x, you need to enable the message trace feature on the client itself. The following shows an example of how to implement this setting:
    Producer Settings
    Push Consumer Settings
    Pull Consumer Settings
    Spring Boot Starter Access (Version 2.2.2 and Above)
    DefaultMQProducer producer = new DefaultMQProducer(namespace, groupName,
    // ACL permission
    new AclClientRPCHook(new SessionCredentials(AK, SK)), true, null);
    // Instantiate the consumer
    DefaultMQPushConsumer pushConsumer = new DefaultMQPushConsumer(NAMESPACE,groupName,
    new AclClientRPCHook(new SessionCredentials(AK, SK)),
    new AllocateMessageQueueAveragely(), true, null);
    DefaultLitePullConsumer pullConsumer = new DefaultLitePullConsumer(NAMESPACE,groupName,
    new AclClientRPCHook(new SessionCredentials(AK, SK)));
    // Set the NameServer address
    pullConsumer.setNamesrvAddr(NAMESERVER);
    pullConsumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_LAST_OFFSET);
    pullConsumer.setAutoCommit(false);
    pullConsumer.setEnableMsgTrace(true);
    pullConsumer.setCustomizedTraceTopic(null);
    package com.lazycece.sbac.rocketmq.messagemodel;
    
    import lombok.extern.slf4j.Slf4j;
    import org.apache.rocketmq.spring.annotation.MessageModel;
    import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
    import org.apache.rocketmq.spring.core.RocketMQListener;
    import org.springframework.stereotype.Component;
    
    /**
    * @author lazycece
    * @date 2019/8/21
    */
    @Slf4j
    @Component
    public class MessageModelConsumer {
    
    @Component
    @RocketMQMessageListener(
    topic = "topic-message-model",
    consumerGroup = "message-model-consumer-group",
    enableMsgTrace = true,
    messageModel = MessageModel.CLUSTERING)
    public class ConsumerOne implements RocketMQListener<String> {
    @Override
    public void onMessage(String message) {
    log.info("ConsumerOne: {}", message);
    }
    }
    
    }

    Directions:

    1. Log in to the TDMQ for RocketMQ console and click Message Query on the left sidebar.
    2. On the message query page, select the region and follow the on-screen instructions to enter the query conditions.
    Time Range: Choose the required time range for the query. Options include the most recent 100 messages (display in chronological order by default), last 30 minutes, last 1 hour, last 6 hours, last 24 hours, last 3 days, or a custom time range.
    Cluster: Select the cluster where the Topic you want to query is located.
    Topic: Select the Topic you want to query.
    Query Method: The following query methods are supported.
    Query All: This method will display all messages in the selected Topic within the selected time range.
    By message ID: This is a precise and high-speed query method with an exact match.
    By message key: This method is a fuzzy query best suited when you have not recorded the message ID but have configured a message key.
    3. Click Query. The results will be displayed by pages in the list below.
    4. Click View message trace in the action column, or select Message Trace in the details page tab bar to view the corresponding message trace.

    Description of Message Trace Query Results

    The query results of the message trace are divided into three sections: message production, message storage, and message consumption.

    Message Production

    Parameter
    Description
    Production Address
    Corresponding producer's address and port.
    Production Time
    The time when the TDMQ for RocketMQ server acknowledged message receipt, accurate to the millisecond.
    Sending duration
    The time expended to send the message from the producer to the TDMQ for RocketMQ server, accurate to the microsecond.
    Production Status
    Whether the message production was successful. A failure generally denotes loss of part of the header data during message transmission, which may result in the preceding fields being NULL.

    Message Storage

    Parameter
    Description
    Storage Time
    The time when the message is persistently stored.
    Storage Duration
    The duration between when the message was persistently stored and when the TDMQ for RocketMQ server received the acknowledgment, accurate to the millisecond.
    Storage Status
    Whether the persistent storage of the message was successful. If the status is failure, the message was not successfully stored, possibly due to disk damage or insufficient capacity. Such situation requires immediate submission of a ticket.

    Message Consumption

    Message consumption is presented in a list format. TDMQ for RocketMQ supports both cluster consumption and broadcast consumption modes.
    The information displayed in the list is as described below:
    Parameter
    Description
    Consumer Group Name
    The name of the Consumer Group.
    Consumption Mode
    The consumption mode of the consumer group, supporting both cluster consumption and broadcast consumption modes.
    Number of Pushes
    The number of times the TDMQ for RocketMQ server sends the message to the consumer.
    Last Pushed Time
    The final instance in which the TDMQ for RocketMQ server sent the message to the consumer.
    Consumption Status
    Unacknowledged: The TDMQ for RocketMQ server has sent the message to the consumer, but has not yet received an acknowledgment from the consumer.
    Acknowledged: The consumer has sent an acknowledgment (ack) to the TDMQ for RocketMQ server and the server has received the acknowledgment.
    Retried: The server has not received an acknowledgment and the message is subsequently sent again due to timeout.
    Retried but Unacknowledged: The TDMQ for RocketMQ server has resent the message to the consumer, but an acknowledgment in response from the consumer has still not been received.
    Moved to Dead Letter Queue: After a number of unsuccessful consumption attempts, the message has been sent to the dead letter queue.
    Note:
    If the consumption mode is broadcasting, the only state of consumption is Pushed.
    
    
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support