leizhiyuan opened a new issue, #1465:
URL: https://github.com/apache/rocketmq-clients/issues/1465

   ### Before Creating the Bug Report
   
   - [x] I found a bug, not just asking a question, which should be created in 
[GitHub Discussions](https://github.com/apache/rocketmq-clients/discussions).
   - [x] I have searched the [GitHub 
Issues](https://github.com/apache/rocketmq-clients/issues) and [GitHub 
Discussions](https://github.com/apache/rocketmq-clients/discussions) of this 
repository and believe that this is not a duplicate.
   - [x] I have confirmed that this bug belongs to the current repository, not 
other repositories of RocketMQ.
   
   ### Programming Language of the Client
   
   Go
   
   ### Runtime Platform Environment
   
   macOS 27.0.1 arm64
   
   ### RocketMQ Version of the Client/Server
   
   Client: Go master `e90ece7a`
   Server: RocketMQ 5.x proxy
   
   ### Run or Compiler Version
   
   go1.27.0 darwin/arm64
   
   ### Describe the Bug
   
   `SimpleConsumer.Ack` (also used by `LiteSimpleConsumer`) and 
`PushConsumer.Ack` return `nil` when the server answers with a non-OK status. 
The caller cannot tell that the ack failed, for example because the receipt 
handle is invalid or expired.
   
   Both methods only mark the ACK hook as failed and then return `nil` 
([simple_consumer.go#L503-L508](https://github.com/apache/rocketmq-clients/blob/e90ece7a/golang/simple_consumer.go#L503-L508),
 
[push_consumer.go#L609-L613](https://github.com/apache/rocketmq-clients/blob/e90ece7a/golang/push_consumer.go#L609-L613)):
   
   ```go
   if resp.GetStatus().GetCode() != v2.Code_OK {
        messageHookPointsStatus = MessageHookPointsStatus_ERROR
   }
   sc.cli.doAfter(MessageHookPoints_ACK, messageCommons, duration, 
messageHookPointsStatus)
   return nil
   ```
   
   The other RPCs of the Go client already turn a non-OK status into 
`*ErrRpcStatus` (`ChangeInvisibleDuration`, `endTransaction`, `send`), and 
Java's `SimpleConsumerImpl#ack0` throws the `ClientException` of the status 
code (`StatusChecker.check`).
   
   ### Steps to Reproduce
   
   Receive a message with a `SimpleConsumer`, change its `ReceiptHandle` to 
`"invalid-handle"` and call `Ack`.
   
   ### What Did You Expect to See?
   
   An error carrying the status, like Java (5.2.2, same server): 
`InternalErrorException`, code 50001.
   
   ### What Did You See Instead?
   
   `Ack` returns `nil`.
   
   ### Additional Context
   
   The internal ack of `PushConsumer` (`defaultProcessQueue#ackMessage0`) does 
not use `Ack`; it calls `ack0` and checks the status itself, so it is not 
affected.
   


-- 
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