Obtém os resultados de uma tarefa de consulta de rastreamento de mensagens usando o ID da tarefa.
Descrição da operação
A OpenAPI do Alibaba Cloud é uma API de gerenciamento. Use-a para gerenciar e consultar recursos dos serviços do Alibaba Cloud. Integre esta API apenas para fins de gerenciamento. Não use esta API no link de dados principal para envio e recebimento de mensagens, pois isso pode criar ameaças ao seu link de dados.
-
Após criar uma tarefa de consulta de rastreamento de mensagens chamando a operação OnsTraceQueryByMsgId ou OnsTraceQueryByMsgKey, você recebe um ID de tarefa. Em seguida, você pode chamar esta operação para obter os detalhes do rastreamento da mensagem. O ID da tarefa é o QueryId retornado pela operação de criação.
-
As tarefas de consulta de rastreamento de mensagens consomem tempo. Se você chamar esta operação imediatamente após criar uma tarefa, a consulta poderá retornar um resultado vazio. Se isso ocorrer, aguarde um curto período e tente chamar novamente.
Experimente agora
Testar
Autorização RAM
|
Ação |
Nível de acesso |
Tipo de recurso |
Chave de condição |
Ação dependente |
|
mq:GetTraceResult |
get |
*Topic
*Topic
|
Nenhuma |
|
Parâmetros da solicitação
|
Parâmetro |
Tipo |
Obrigatório |
Descrição |
Exemplo |
| QueryId |
string |
Sim |
O ID da tarefa para a qual obter os resultados da consulta de rastreamento de mensagens. |
272967562652883649157096685**** |
| InstanceId |
string |
Não |
O ID da instância que contém a mensagem que você deseja consultar. |
MQ_INST_111111111111_DOxxxxxx |
| Topic |
string |
Não |
O tópico da mensagem que você deseja consultar. |
test |
Elementos de resposta
|
Elemento |
Tipo |
Descrição |
Exemplo |
|
object |
|||
| RequestId |
string |
O ID da solicitação. Este é um parâmetro comum. Cada solicitação tem um ID exclusivo que você pode usar para solucionar problemas. |
84EE24D2-851F-40D6-B99E-4D6AB909**** |
| TraceData |
object |
Os detalhes dos resultados da tarefa de consulta. |
|
| Status |
string |
O resultado da tarefa de consulta. Valores válidos:
|
finish |
| MsgKey |
string |
A chave da mensagem que corresponde à tarefa de consulta. |
ORDERID_100 |
| UpdateTime |
integer |
A hora da última atualização da tarefa de consulta. |
1570966877000 |
| CreateTime |
integer |
A hora de criação da tarefa de consulta. |
1570966857000 |
| Topic |
string |
O tópico da tarefa de consulta. |
test |
| UserId |
string |
O ID do usuário que iniciou a consulta. |
27296756265288**** |
| InstanceId |
string |
O ID da instância. |
MQ_INST_111111111111_DOxxxxxx |
| MsgId |
string |
O ID da mensagem que corresponde à tarefa de consulta. |
1E05791C117818B4AAC23B1BB0CE**** |
| TraceList |
object |
||
| TraceMapDo |
array<object> |
The list of matched message traces for the query task. |
|
|
array<object> |
|||
| Status |
string |
The sending status. Valid values:
|
SEND_SUCCESS |
| MsgKey |
string |
The message key. |
ORDERID_100 |
| PubTime |
integer |
The time when the message was sent. |
1570850870478 |
| SubList |
object |
||
| SubMapDo |
array<object> |
The list of consumption traces for the message. |
|
|
array<object> |
|||
| ClientList |
object |
||
| SubClientInfoDo |
array<object> |
The list of consumption records for the client that belongs to the group ID. |
|
|
object |
|||
| Status |
string |
The consumption status. Valid values:
|
CONSUME_SUCCESS |
| SubTime |
integer |
The UNIX timestamp for when the consumption started. |
1570851590511 |
| ReconsumeTimes |
integer |
The number of delivery attempts for this consumption. |
1 |
| SubGroupName |
string |
The group ID to which the client belongs. |
GID_test |
| ClientHost |
string |
The address of the consumer client. |
30.5.**.** |
| CostTime |
integer |
The time taken for this consumption, in milliseconds. |
43 |
| FailCount |
integer |
The number of consumption failures for the group ID. |
0 |
| SubGroupName |
string |
The group ID of the consumer. |
GID_test |
| SuccessCount |
integer |
The number of successful consumptions for the group ID. |
1 |
| Topic |
string |
The topic of the message. |
test |
| CostTime |
integer |
The time taken to send the message, in milliseconds. |
24 |
| Tag |
string |
The message tag. |
TagA |
| MsgId |
string |
The message ID. |
0BC1F01800002A9F000000531246**** |
| PubGroupName |
string |
The group ID configured on the producer client. |
GID_test |
| BornHost |
string |
The address of the producer client. |
30.5.**.** |
| QueryId |
string |
O ID da tarefa de consulta. |
272967562652883649157096685**** |
Exemplos
Resposta de sucesso
JSON formato
{
"RequestId": "84EE24D2-851F-40D6-B99E-4D6AB909****",
"TraceData": {
"Status": "finish",
"MsgKey": "ORDERID_100",
"UpdateTime": 1570966877000,
"CreateTime": 1570966857000,
"Topic": "test",
"UserId": "27296756265288****",
"InstanceId": "MQ_INST_111111111111_DOxxxxxx",
"MsgId": "1E05791C117818B4AAC23B1BB0CE****",
"TraceList": {
"TraceMapDo": [
{
"Status": "SEND_SUCCESS",
"MsgKey": "ORDERID_100",
"PubTime": 1570850870478,
"SubList": {
"SubMapDo": [
{
"ClientList": {
"SubClientInfoDo": [
{
"Status": "CONSUME_SUCCESS",
"SubTime": 1570851590511,
"ReconsumeTimes": 1,
"SubGroupName": "GID_test",
"ClientHost": "30.5.**.**",
"CostTime": 43
}
]
},
"FailCount": 0,
"SubGroupName": "GID_test",
"SuccessCount": 1
}
]
},
"Topic": "test",
"CostTime": 24,
"Tag": "TagA",
"MsgId": "0BC1F01800002A9F000000531246****",
"PubGroupName": "GID_test",
"BornHost": "30.5.**.**"
}
]
},
"QueryId": "272967562652883649157096685****"
}
}
Códigos de erro
Consulte Códigos de Erro para uma lista completa.
Notas de versão
Consulte Notas de Versão para uma lista completa.