qianye1001 opened a new pull request, #10279:
URL: https://github.com/apache/rocketmq/pull/10279
### Which Issue(s) This PR Fixes
- Fixes #10278
### Brief Description
This PR adds a new dynamic switch `enableReceiptHandleRenew` in
`ProxyConfig` to allow disabling the proxy's periodic receipt handle renewal
mechanism.
**Background**: The current auto-renew approach uses a short invisible time
(~60s) and periodically calls `changeInvisibleTime` to extend it. While this
protects against client crashes, it has a critical flaw: if the **proxy**
crashes, the client's original handle (issued with short invisible time) has
already expired, and the renewed handle is lost in proxy memory. The client
cannot ack through another proxy, causing unavoidable duplicate consumption.
**Changes**:
1. **`ProxyConfig.enableReceiptHandleRenew`** (default `true`): New boolean
switch. When set to `false`:
- The proxy uses the consumer group's `consumeTimeoutMinute` (from
`SubscriptionGroupConfig`) as the invisible time during pop, giving the client
a long-lived handle.
- The proxy skips periodic `changeInvisibleTime` renewal calls.
- Handle storage and client-disconnect cleanup (nack) are preserved.
2. **`ReceiveMessageActivity`**: When `enableReceiptHandleRenew=false`,
resolves the invisible time from the group's `consumeTimeoutMinute` instead of
the short `defaultInvisibleTimeMills`.
3. **`DefaultReceiptHandleManager`**: When `enableReceiptHandleRenew=false`,
the scheduled task still detects client disconnects (and nacks), but skips the
periodic renewal loop.
### How Did You Test This Change?
1. Verified compilation passes (`mvn compile -pl proxy -am`).
2. Verified no IDE errors in all modified files.
3. Existing unit tests in `DefaultReceiptHandleManagerTest` and
`ReceiptHandleProcessorTest` continue to pass (they test with default
`enableReceiptHandleRenew=true`).
--
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]