tencent cloud

Feedback

Message Trace Description

Last updated: 2023-03-14 15:31:36
    A message trace records the entire process of how a message flows, including the duration of each stage (accurate down to the microsecond), execution result, producer IP, and consumer IP.

    Prerequisites

    You have deployed the producer and consumer services as instructed in the SDK Documentation, and they have produced and consumed messages in the last three days.
    You need to enable and set the message trace feature on the client as follows:
    Producer settings
    Push consumer settings
    Pull consumer settings
    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);
    If you use Spring Boot Starter 2.2.2 or later for access, see below for the specific code:
    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 a region and enter the query conditions as prompted.
    Time Range: Select the time range for query. You can select the last 6 hours, last 24 hours, or last 3 days, or set a custom time range.
    Current Cluster: Select the cluster where the topic you want to query is located.
    Namespace: Select the namespace where the topic you want to query is located.
    Topic: Select the topic you want to query.
    Query Method: Below are two supported query methods.
    By message ID: A fast exact query method.
    By message key: A fuzzy query method that is used when you have only set the message key.
    3. Click Query, and the paginated results will be displayed in the list.
    4. Click View Message Trace in the Operation column or select the Message Trace tab on the details page to view the trace of the message.

    Message trace query result description

    A message trace query result consists of three parts: message production, message storage, and message consumption.

    Message production

    Parameter
    Description
    Producer Address
    Address and port of the producer.
    Production Time
    The time when the TDMQ for RocketMQ server acknowledged message receipt, accurate down to the millisecond.
    Sending Duration
    The time it took to send the message from the producer to the TDMQ for RocketMQ server, accurate down to the microsecond.
    Production Status
    Message production success or failure. If the status is Failed, it is generally because the header of the message was lost during sending, and the above fields may be empty.

    Message storage

    Parameter
    Description
    Storage Time
    The time when the message was persistently stored.
    Storage Duration
    The duration between when the message was persistently stored and when the TDMQ for RocketMQ server received the acknowledgment, accurate down to the millisecond.
    Storage Status
    Message storage success or failure. If the status is Failed, the message failed to be stored on the disk, which is possibly because the underlying disk was damaged or full. In this case, submit a ticket for assistance as soon as possible.

    Message consumption

    Message consumption details are displayed in a list. TDMQ for RocketMQ supports two consumption modes: cluster consumption and broadcast consumption.
    The information displayed in the list is as described below:
    Parameter
    Description
    Consumer Group Name
    Name of the consumer group.
    Consumption Mode
    The consumer group's consumption mode, which can be either cluster consumption or broadcast consumption. For more information, see Cluster Consumption and Broadcast Consumption.
    Number of Pushes
    The number of times the TDMQ for RocketMQ server has delivered the message to consumers.
    Last Pushed
    The last time the TDMQ for RocketMQ server delivered the message to consumers.
    Consumption Status
    Pushed yet unacknowledged: The TDMQ for RocketMQ server has delivered the message to consumers but has not received their acknowledgment.
    Acknowledged: Consumers acknowledged the consumption and the TDMQ for RocketMQ server has received the acknowledgment.
    Put to retry queue: Acknowledgment timed out. The server will deliver the message to consumers again as it did not receive their acknowledgment.
    Retried yet unacknowledged: The TDMQ for RocketMQ server has delivered the message to consumers again but still has not received their acknowledgment.
    Put to dead letter queue: The message has been put to the dead letter queue as it failed to be consumed after multiple retries.
    Note: If the consumption mode is broadcast, the consumption status can only be Pushed.
    You can view the message push details by clicking the right triangle on the left of the subscription name.
    Parameter
    Description
    Push Sequence
    The sequence number in which the TDMQ for RocketMQ server delivers the message to consumers.
    Consumer Address
    Address and port of the consumer receiving the message.
    Push Time
    The time when the TDMQ for RocketMQ server delivers the message to consumers.
    Consumption Status
    Pushed yet unacknowledged: The TDMQ for RocketMQ server has delivered the message to consumers but has not received their acknowledgment.
    Acknowledged: Consumers acknowledged the consumption and the TDMQ for RocketMQ server has received the acknowledgment.
    Put to retry queue: Acknowledgment timed out. The server will deliver the message to consumers again as it did not receive their acknowledgment.
    Retried yet unacknowledged: The TDMQ for RocketMQ server has delivered the message to consumers again but still has not received their acknowledgment.
    Put to dead letter queue: The message has been put to the dead letter queue as it failed to be consumed after multiple retries.
    Redelivered to retry queue: On the dead letter queue resending page, the dead letter message has been redelivered to the retry queue of the original queue.
    
    
    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