Message Service (MNS) provides message tracing to track each message through its full lifecycle—sending, subscription matching, push, and consumption—with timestamps, results, and producer/consumer identities for troubleshooting.
Use cases
The message trace feature helps you:
-
Confirm message delivery: Verify whether a message reached its queue or topic and was consumed.
-
Troubleshoot duplicate consumption: View a message's complete consumption record—time, consumer identity, and result of each consumption.
-
Troubleshoot push failures: View detailed status and failure reasons for topic subscription pushes (HTTP, email, etc.).
-
Troubleshoot message latency: View timestamps for each lifecycle stage to pinpoint delays.
-
Check scheduled message status: Verify whether a scheduled message has reached its delivery time.
-
Query producer and consumer identities: View producer IP, AccessKey, and consumer IP for troubleshooting.
Trace parameters
Queue message trace
A message trace consists of three sections: Send Information, Message Information, and Consumption Information.
Sending messages
Standard sending
|
Parameter |
Description |
|
Message source |
A producer that sends the message directly to the queue. |
|
Method |
The API operation, such as SendMessage or BatchSendMessage. |
|
Producer IP |
The sending client's IP address. |
|
AccessKey |
The AccessKey used to send the message. |
|
Send time |
The server time when the message arrived at the queue. |
|
Result |
Shows "Success" or a specific error message. |
Dead-letter
A new trace is generated when a message moves to a dead-letter queue.
|
Parameter |
Description |
|
Message source |
Constant: Dead-Letter |
|
Original queue |
The name of the message's original queue. |
|
Original queue Message ID |
The Message ID of the message in the original queue. |
|
Send time |
The time the message moved to the dead-letter queue. |
|
Result |
Shows "Success" or a specific error message. |
Subscription push
Generated when a topic pushes a message to a queue through a subscription.
|
Parameter |
Description |
|
Message source |
Constant: Topic Queue Subscription |
|
Topic |
The name of the topic that pushed the message. |
|
Subscription |
The name of the subscription that pushed the message. |
|
Original Message ID |
The Message ID of the message in the topic. |
|
Send time |
The time the message was pushed to the queue. |
|
Result |
Shows "Success" or a specific error message. |
Other cloud services
Generated when EventBridge pushes a message to a queue through a subscription.
|
Parameter |
Description |
|
Message source |
Constant: other cloud services |
|
Method |
Constant: Notify |
|
Send time |
The time the message was pushed to the queue. |
|
Result |
Shows "Success" or a specific error message. |
Message information
Standard message
|
Parameter |
Description |
|
Message type |
Value: standard message |
|
Message ID |
A unique identifier for the message. |
|
Queue |
The name of the queue that contains the message. |
|
Retention period |
Maximum storage duration. Corresponds to the queue's |
|
Visibility timeout |
Duration a retrieved message stays invisible to other consumers. Corresponds to the queue's |
Scheduled message
|
Parameter |
Description |
|
Message type |
Value: scheduled message |
|
Message ID |
A unique identifier for the message. |
|
Queue |
The name of the queue that contains the message. |
|
Retention period |
Maximum storage duration. Corresponds to the queue's |
|
Visibility timeout |
Duration a retrieved message stays invisible to other consumers. Corresponds to the queue's |
|
Delivery delay |
The time in seconds to delay the message's delivery. |
|
Scheduled delivery time |
The specific time when the message will become available for consumption. |
Consumption
A queue message's consumption trace is grouped into consumption sessions, each identified by a ReceiptHandle.
|
Parameter |
Description |
|
Result |
The final result of the consumption session. Possible values include:
|
|
Consumer IP |
The client IP address that received or operated on the message. |
|
AccessKey |
The AccessKey used to operate on the message. |
|
ReceiptHandle |
The message handle, used to delete the message or change its visibility timeout. |
|
Operation Time |
The server time of the operation. |
|
Operation |
The API operation. Possible values include:
|
-
A message can have multiple
ReceiptHandlevalues because a new handle is generated each time you callReceiveMessageorBatchReceiveMessage. -
If a consumer deletes a message before its message visibility timeout expires, the consumption session result is Success.
-
If a consumer receives a message but does not delete it, the message can be consumed again after its message visibility timeout expires. Receiving the message again generates a new
ReceiptHandle. -
Operating on a message with an expired
ReceiptHandlereturns a 404 error.
Topic message trace
A topic message trace includes three sections: sending information, subscription matching information, and push information.
Sending information
Standard sending
|
Parameter |
Description |
|
Message source |
A producer published the message directly to the topic. |
|
Method |
The API operation type: PublishMessage |
|
Producer IP |
The IP address of the client that published the message. |
|
AccessKey |
The AccessKey used to publish the message. |
|
Send time |
The server time when the message arrived at the topic. |
|
Result |
The result of the publish operation. Displays "Success" or a specific error message. |
Other cloud services
Generated when another cloud service publishes a message to the topic.
|
Parameter |
Description |
|
Message source |
Indicates the message came from another cloud service. |
|
Method |
The API operation type: PublishMessage |
|
Send time |
The time when the message was published to the topic. |
|
Result |
The result of the publish operation. Displays "Success" or a specific error message. |
Subscription matching
When a topic receives a message, it matches subscriptions by FilterTag and pushes the message to each match.
|
Parameter |
Description |
|
Message ID |
The unique identifier of the message. |
|
Tag |
The tag of the message, used for subscription filtering. |
|
Subscription name |
The name of the matched subscription. |
|
Subscription type |
The type of the subscription's endpoint. Possible values include:
|
Push information
Queue subscription
|
Parameter |
Description |
|
Message ID |
The new ID assigned to the message once it enters the queue. |
|
Consumption result |
Indicates if the push succeeded. Displays "Success" or a specific error message. |
|
Push time |
The time when the push started. |
|
Processing duration |
The push duration, in milliseconds. |
Other subscriptions
|
Parameter |
Description |
|
Push result |
The status code and result of the push, such as:
|
|
Push time |
The time when the push started. |
|
Processing duration |
The push duration, in milliseconds. |
Usage limits
-
Message Trace: Message Trace is disabled by default. You can enable it on the Message Trace page.
-
Query time range: Queries can span a maximum of 3 days and must start within the last 15 days.
Billing
Billing details: Message trace costs.
Message trace retention period
Message trace data is retained for 15 days, after which it is automatically deleted and can no longer be queried.
Query methods
ApsaraMQ for MNS provides five methods to query message traces:
|
Query method |
Use case |
Result |
|
Query by message ID |
You know the message ID and want to find the complete trace for that message. |
Returns a single message trace. |
|
Query by request ID |
You know the request ID for an API call and want to find the messages involved. |
Returns the message traces associated with the request. |
|
Query by queue name |
You want to view all message traces for a queue over a period of time. |
Returns the message traces for the queue within the specified time range. |
|
Query by topic name |
You want to view all message traces for a topic over a period of time. |
Returns the message traces for the topic within the specified time range. |
|
Query by subscription name |
You want to view all message traces pushed to a subscription over a period of time. |
Returns message traces for messages pushed to the subscription within the specified time range. |
-
If you know the message ID, use Query by message ID to get fast, precise results.
-
To troubleshoot message issues over a period of time, use Query by queue name, Query by topic name, or Query by subscription name.
-
Use Query by request ID to troubleshoot API call issues related to batch sending or batch consumption.
Procedure
Query message traces
Log on to the SMQ console.
-
In the left-side navigation pane, choose .
In the top navigation bar, select a region.
-
Click Off to enable message trace.
-
On the Message Trace page, select a query method and enter the search criteria.
-
Query by Message ID: Enter a message ID and click Query.
-
Query by RequestID: Enter the RequestID of an API request and click Query.
-
Query by Queue Name: Select a queue name, select a start time within the last 15 days (the duration cannot exceed 3 days), and click Query.
-
Query by Topic Name: Select a topic name, select a start time within the last 15 days (the duration cannot exceed 3 days), and click Query.
-
Query by Subscription Name: Select a topic and a subscription name, select a start time within the last 15 days (the duration cannot exceed 3 days), and click Query.
-
-
In the query results, find the target message, and in the Actions column, click Details.
-
The message trace details page shows the full trace of the message.
-
Queue message trace details: Includes Sending Information, Message Information, and Consumption Information.
-
Sending Information: Includes the message source, sending method, producer IP address, AccessKey, arrival time, and sending result.
-
Message Information: Includes the message ID, queue name, retention period, visibility timeout, and more. For a scheduled message, the delay duration and scheduled delivery time are also displayed.
-
Consumption Information: Message consumption records are grouped by ReceiptHandle. Expand a ReceiptHandle to view all operations in that consumption session, including the time, consumer IP address, and result for receiving, deleting, and changing message visibility.
-
-
Topic message trace details: Includes Sending Information, Subscription Matching Information, and Push Information.
-
Sending Information: Includes the sending method, producer IP address, AccessKey, arrival time, and sending result.
-
Subscription Matching Information: Includes the message ID, tag, matched subscription name, and subscription type.
-
Push Information: Includes the push result, push time, and more for each subscription. For queue subscriptions, the new message ID after the push is displayed. For HTTP, email, or SMS subscriptions, the push status code and processing duration are shown.
-
-
-
(Optional) To view the message trace after a message is pushed to a queue by a queue subscription, click the Message ID link in the Push Information section to view the trace details for the corresponding queue message.
This page shows Sending Information (producer, method, time, result), Message Information (message type, subscription list), and Consumption Information (message ID, consumption result, push time, processing duration).
FAQ
Q: Why can't I find a message trace?
A: Possible causes include:
-
Message trace data is deleted after 15 days.
-
The specified time range is incorrect. Try expanding the time range.
-
The message ID or RequestID was entered incorrectly. Check the ID and try the query again.
Q: What does the 'Not Responded' status in a message trace mean?
A: A consumer received the message but did not delete it or change its visibility timeout. When the timeout expires, the message becomes available again. Check your consumer application to ensure it processes and deletes messages correctly.
Q: Why does a single message have multiple ReceiptHandles?
A: Each ReceiveMessage or BatchReceiveMessage call generates a new ReceiptHandle. If a message is retrieved multiple times (for example, after its visibility timeout expires), each retrieval produces a different ReceiptHandle.
Q: Does message tracing affect the performance of sending and receiving messages?
A: No. Trace recording is asynchronous and does not affect message send/receive performance or reliability. Recording failures do not impact normal operations.