Message query
If a message is consumed, you can query the content of the message to troubleshoot the issue. SOFAStack MSMQ allows you to query messages by message ID, message key, and topic.
Procedure
Log on to the SOFAStack console.
In the left-side navigation pane, choose Middleware > MSMQ > Message Query.
On the Message Query page, click one of the following tabs and enter the required information.
Query by message ID: The message ID is a 32-bit string generated by the server to identify a message. You can query messages by message ID based on the topic and message ID. We recommend that you print the message ID to logs after the message is sent. This facilitates troubleshooting. You can obtain the message ID as follows:
SendResult sendResult = producer.send(msg); String msgId = sendResult.getMessageId();Query by message key: The message key is set to the key field in the message object when the message is sent. You MSMQ create an index for the message based on the specified message key. By message key, the last 64 messages that contain the specified key are matched based on the topic and message key. You can set the message key as follows:
Message msg =new Message("Topic","*","Hello MQ".getBytes()); // The key value represents the business key attribute of the message. Make sure that the key value is globally unique. msg.setKey("TestKey"+System.currentTimeMillis());Query by Topic: indicates that all messages within the specified time range are obtained in batches based on the topic and the time range when the messages are sent. This method is used when the message ID and message key cannot be obtained.
Click Search.
On the Message Query page, you can view all the queried messages and their overview information, including the message ID, tag, key, and storage time. You can also query message traces and view message details.
Unitization Description
In the LDC unit architecture environment, you can freely switch units and query messages in specified units, as shown in the following figure. 