zhaohai666 opened a new pull request, #1473:
URL: https://github.com/apache/rocketmq-clients/pull/1473

   ## Purpose
   
   The Go push consumer's settlement chains (ack, change invisible duration, 
forward to dead letter queue) never gave up: an expired receipt handle was 
renewed once per second forever, retries kept being scheduled after the process 
queue was dropped or the consumer stopped, and the SimpleConsumer swallowed 
server errors on `Ack` and `ChangeInvisibleDuration`.
   
   ## Changes
   
   - `defaultProcessQueue.changeInvisibleDuration`: `changeInvisibleDuration0` 
converts a non-OK status into an error, so the existing 
`INVALID_RECEIPT_HANDLE` abandon branch (inside the `status` handling) was 
unreachable. The abandon check now runs on the returned error before the 
generic failure handling, so an expired receipt handle is forgiven immediately 
instead of being renewed once per second forever.
   - Cap the ack / change invisible duration / forward-to-DLQ retry chains at 
`MAX_*_ATTEMPTS = 3` and stop scheduling retries once the process queue was 
dropped or the consumer is no longer running. The DLQ chain previously never 
gave up on any status code; it now also forgives `INVALID_RECEIPT_HANDLE`, and 
its timer uses `FORWARD_FIFO_MESSAGE_TO_DLQ_FAILURE_BACKOFF_DELAY` instead of 
the ack delay.
   - `onReceiveMessageException`: restore the Java semantics (see 
`ProcessQueueImpl.java`) — the default retry delay is 
`RECEIVING_FAILURE_BACKOFF_DELAY` (1s) and only flow control 
(`TOO_MANY_REQUESTS`) retries after the short 
`RECEIVING_FLOW_CONTROL_BACKOFF_DELAY` (20ms). The two constants were swapped.
   - `SimpleConsumer.ChangeInvisibleDuration`: only adopt the receipt handle 
from a successful response. A failed response used to overwrite 
`messageView.ReceiptHandle` with the empty string, making every following call 
fail permanently with `INVALID_RECEIPT_HANDLE`.
   - `SimpleConsumer.Ack`: return the server status as an `ErrRpcStatus` 
instead of `nil` on a non-OK response.
   - Log text fixes: renewal/DLQ failure logs mislabeled the operation as 
"message acknowledgement"; `%w` verbs are not expanded by zap and printed as 
`%!w(...)`, now `%v`.
   
   ## Test plan
   
   - 7 new unit tests: immediate forgiveness of `INVALID_RECEIPT_HANDLE` for 
change invisible duration and DLQ, retry caps (exactly 3 attempts), retries 
stop after the queue is dropped / the consumer stops, `SimpleConsumer.Ack` 
returns the non-OK status, `SimpleConsumer.ChangeInvisibleDuration` keeps the 
old receipt handle on failure.
   - `go build ./...`, `go vet .` clean; `go test -count=1 .` passes.


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