All Products
Search
Document Center

ApsaraMQ for RocketMQ:Message traces

Last Updated:Apr 28, 2024

ApsaraMQ for RocketMQ is a key service for asynchronous decoupling in business built around distributed architectures. The trace data that is provided by ApsaraMQ for RocketMQ effectively connects the upstream and downstream applications of business. This helps you identify and troubleshoot exceptions. This topic describes scenarios in which message traces are applicable and trace parameters provided by ApsaraMQ for RocketMQ. This topic also describes how to view message traces.

Common scenarios

Critical data for messaging is defined as trace parameters in ApsaraMQ for RocketMQ. ApsaraMQ for RocketMQ provides the visualization feature that displays query and analysis results in charts. You can quickly obtain business status and identify exceptions by querying message traces.

The following describes typical scenarios in which message traces are used:

  • Scenario 1: Check whether a message is sent or consumed.

  • Scenario 2: Check whether scheduled or delayed messages are delivered at the scheduled time.

  • Scenario 3: Check whether transactional messages are committed or rolled back.

  • Scenario 4: Check the identity information and machine information of producers and consumers for troubleshooting.

Trace parameters

The following table describes trace parameters in ApsaraMQ for RocketMQ.

Category

Parameter

Description

Producer

Producer Information

The ApsaraMQ for RocketMQ account or AccessKey ID that the producer used to send the message.

Hostname

The hostname of the machine where the producer client resides.

Sent At

The time when the producer started to send the message.

Arrival At

The time when the message was stored in the ApsaraMQ for RocketMQ broker.

Sending Result

The result of message sending. Valid values:

  • Sent

  • Failed

Basic message information

Message Type

Message ID

The globally unique identifier of the message. This identifier is automatically generated by the ApsaraMQ for RocketMQ system.

Topic

The name of the topic to which the message belongs.

Message Key

The message key. The key of a message is the business identifier set by the producer to uniquely identify the business logic.

Message Tag

The message tag. The tag is used to specify the consumption type of a message in a specific topic.

Ordered message

Message Group

The group to which the message belongs. The group to which an ordered message belongs is specified by the producer. Messages in the same group are processed in the first-in, first-out (FIFO) order.

Transactional message

Check Callback Time

The callback time when the transaction status was checked for the half message.

Committed At

The time when the transactional message was committed to the consumer by the broker.

Rolled back At

The time when the transactional message was rolled back.

Scheduled message

Preset Delay Time

The time when the message was scheduled to be sent.

Consumer

Consumption Result

The consumption result of the message. Valid values:

  • Consumed

  • Failed

  • No Response

Consumer Information

The ApsaraMQ for RocketMQ account or AccessKey ID that the consumer used to subscribe to the message.

Hostname

The hostname of the machine where the consumer client resides.

Ordered Delivery

Indicates whether ordered delivery was enabled for the consumer group to which the consumer belongs.

Delivery Time

The time when the ApsaraMQ for RocketMQ broker delivered the message to the consumer.

Response Time

The time when the ApsaraMQ for RocketMQ broker received the consumption result returned by the consumer.

Invisible Duration

The period of time during which the message sent by the simple consumer was invisible. For more information, see Retry policies for messages consumed in Simple mode.

Modify Invisible Duration

The time when the simple consumer called the ChangeInvisibleDuration operation.

Time of Entering Dead-letter Queue

The time when the message was delivered to the dead-letter queue if the message failed to be consumed.

Limits

By default, the message trace feature is disabled on clients that use Apache RocketMQ 3.x or 4.x SDKs. For more information, see Overview. If you use such a client and want to query message traces in the ApsaraMQ for RocketMQ console, you must enable the message trace feature in the messaging code. The following items describe the detailed configurations in the messaging code:

  • Producer

    producer.setAccessChannel(AccessChannel.CLOUD);
  • Consumer

    consumer.setAccessChannel(AccessChannel.CLOUD);

Billing rules

You are not charged for the message trace storage and message trace query features of ApsaraMQ for RocketMQ.

Storage duration

Message traces can be stored in ApsaraMQ for RocketMQ brokers for three days. You can query message traces within three days from the current time.

Query methods

ApsaraMQ for RocketMQ allows you to query message traces by using one of the following methods:

  • Query by message ID: This method is recommended for its exact matching and fast speed.

  • Query by message key: This method is a fuzzy query. If you use this method, you can query up to 1,000 message traces at a time. If you know the key of the message that you want to query but do not know the ID of the message, you can use this method.

  • Query by topic: This method is a range query. It is suitable for scenarios in which no message ID or message key is recorded and the number of messages is small. We recommend that you do not use this query method. In most cases, a large number of messages are produced in a topic within a specific time range. If you use this method, you can hardly identify a specific message among the queried messages.

Query a message trace

  1. Log on to the ApsaraMQ for RocketMQ console. In the left-side navigation pane, click Instances.

  2. In the top navigation bar, select a region, such as China (Hangzhou). On the Instances page, click the name of the instance that you want to manage.

  3. In the left-side navigation pane, click Message Traces. On the Message Traces page, select a query method to create a query task.

  4. View the trace details based on the query result.