unbridled-41 opened a new issue, #4601:
URL: https://github.com/apache/rocketmq-dashboard/issues/4601

   ## Problem
   
   `POST /api/messages/direct-consume` answers HTTP 502 with the raw broker 
text when the typed consumer client is not connected. A client that is not 
online is a normal business state for that dialog (the group and client id are 
typed by hand, so a stale id or a restarted client is the common case), not a 
gateway failure.
   
   ## Evidence
   
   `server/.../provider/apache/RocketMQMessageProvider.java` 
(`consumeMessageDirectly`, before the fix): the call was executed without any 
exception grading, so the broker's answer propagated to `MqAdminExtFactory`, 
which wraps every non-`BusinessException` into a 502:
   
   ```java
   throw new BusinessException(502, "RocketMQ admin call failed: " + 
rootMessage(ex));
   ```
   
   The broker answers that condition with `SYSTEM_ERROR` (code 1) and the 
remark `The Consumer <group> <client> not online`; through `MQClientException` 
it surfaces as:
   
   ```
   CODE: 1  DESC: The Consumer billing client-offline not online
   For more information, please visit the url, 
https://rocketmq.apache.org/docs/bestPractice/06FAQ
   ```
   
   which is what the operator sees in the Message page's 直接消费 dialog 
(`web/src/pages/instance/message.tsx`).
   
   The sibling endpoint that reports on the same consumer client already grades 
this answer as a 404: `RocketMQConsumerDiagnosticsProvider` maps a root message 
containing `not online` to `new BusinessException(404, 
notReachable(clientId))`, with the comment that the broker answers "not online" 
for every proxy-connected client and that this is a business state.
   
   Reproduction (regression test added with this report, 
`RocketMQMessageProviderTest.directlyConsumesMessageReportsAnOfflineClientAsNotFound`):
 stub `consumeMessageDirectly` to throw 
`MQClientException(ResponseCode.SYSTEM_ERROR, "The Consumer billing 
client-offline not online")`. Before the fix the provider rethrows the raw 
client exception instead of a `BusinessException`.
   
   ## Impact
   
   The operator gets an opaque 502 "RocketMQ admin call failed: CODE: 1 DESC: 
The Consumer ... not online <FAQ url>" instead of a clear "this client is not 
online", and a client-side failure is reported as a gateway failure (which also 
affects any monitoring that classifies 5xx).
   
   ## Expected behavior
   
   A direct consume against a client that is not online is reported as a 
not-found condition (like the consumer stack endpoint), while other broker 
failures keep the 502 grading.
   
   ## Related work
   
   - `RocketMQConsumerDiagnosticsProvider#diagnosticsFailure` grades the 
identical broker answer as a 404 for the consumer stack endpoint.
   - `RocketMQClientProvider#isGroupConnectionAbsent` treats 
`CONSUMER_NOT_ONLINE` and "Not found the producer group connection" as normal 
"nothing here" outcomes.
   - #4556/#4560 and the offline-group grading changes (#4002, #4258, #4261) 
are the same "normal state must not be a gateway failure" class.
   
   ## PR
   
   Fix incoming.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to