tencent cloud

Feedback

Query General Message

Last updated: 2024-08-21 11:12:38
    When sending a message from its origin at the producer to the TDMQ for RocketMQ server, and finally to the consumers, TDMQ for RocketMQ records the flow progress of the message and displays as a message trace in the console.
    The message trace records the full course of the message, from its origin at the producer to the TDMQ for RocketMQ server, and finally to the consumers. This includes details about each phase, such as time duration (accurate to the microsecond), execution results, producer IP, and consumer IP.
    If you use a client version 5.0 or later one for producing and consuming messages, there is no need to individually enable the trace switch on the client.
    If you use a client v4.x, you need to enable the message trace feature via the client. An example of specific setting is as follows:
    For more information about the client, see Community Client Instructions.
    Producer settings
    Push consumer settings
    Pull consumer settings
    Spring Boot Starter Access (version 2.2.2 and later)
    DefaultMQProducer producer = new DefaultMQProducer(namespace, groupName,
    // ACL permissions
    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);
    }
    }
    
    }

    Overview

    When you need to investigate the following issues, you can utilize the message query features in the TDMQ for RocketMQ console. You can search for specific messages by time dimension, or by message ID or message Key found in the logs, in order to view the message content, parameters, and trace.
    View the specific content and parameters of a given message.
    View the producer IP from which a message was sent, verify its successful sending, and determine the specified time of its arrival at the server.
    View whether the message has been persistently stored.
    View which consumers consumed the consumption, whether the consumption was successful or not, and the message confirms the specified time of the consumption.
    Conduct a performance analysis of the distributed system by viewing the message processing latency of the message queue.

    Directions

    1. Log in to the RocketMQ console and click on Message Query in the left sidebar.
    2. On the message query page, after selecting the region, follow the instructions to input the query conditions.
    Time Range: Select the desired query time range, supporting the options of the most recent 100 messages (default choice displays the latest 100 messages in chronological order), the last 30 minutes, last 1 hour, last 6 hours, last 24 hours, last 3 days, or a customizable time range.
    Cluster: Select the cluster where the Topic you intend to query is located.
    Topic: Select the desired Topic.
    Query Method: The message query feature supports the following query methods.
    Query all: This method is suitable for querying all messages.
    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. It is suitable for a scene where you have set a message key with no recorded message ID.
    3. Click Query. The list below will show all the results of the search, displayed by pages.
    
    4. Locate contents or parameters of the message you require to view. Click View Details in the operation column to access the basic information, content (message body), detailed parameters, and consumption status of the message.
    In the consumption status module, you can view the Group that consumed the message and the consumption status. In the operation column, you can also perform the following operations:
    Resend: This operation sends the message to a specific client again. If the message has already been successfully consumed, resending it may lead to duplicated consumption.
    Exception Diagnosis: If consumption is abnormal, you can view the exception diagnosis information.
    
    5. Click View Message Trace in the operation column, or click Message Trace in the details page. You can view the message trace of the message (For detailed information, please see Overview of Message Trace Query Results).
    

    Consumption Verification

    After querying a message, you can click Verify Consumption in the operation column to send the message to a specified client for verification. Using this feature may lead to message duplication.
    Note:
    The consumption verification function is only used to verify whether the client's consumption logic is normal or not, and will not affect the normal process of receiving messages, so information such as the consumption status of the message will not change after the consumption verification.
    Consumption verification feature currently does not support sending messages to Python and C clients.
    

    Export Messages

    After querying a message, you can click Export Message in the operation column to export details such as the message body, message Tag, message Key, message production time and consumption attributes.

    Downloading Messages

    On the message details page, you can click the Download Message button to save the message body and header of a single message to the local storage.
    
    
    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