Marandi269 opened a new pull request, #1169:
URL: https://github.com/apache/rocketmq-clients/pull/1169
### Which Issue(s) This PR Fixes
Fixes #1168
### Brief Description
This PR addresses an issue where `PushConsumer` fails to receive messages
while `SimpleConsumer` works correctly with the same configuration.
**Root Cause Analysis:**
In `rpc_channel.py:136-140`, `reset_setting()` was nested inside the `if
res.settings.metric:` condition:
```python
# Before
if res.settings and res.settings.metric:
self.__handler.reset_metric(res.settings.metric)
self.__handler.reset_setting(res.settings)
```
When the server returns settings without metric data, `reset_setting()`
would be skipped. This causes:
1. `PushConsumer.__consumption` remains `None` (initialized in
`reset_setting()` → `__configure_consumer_consumption()`)
2. `__scan_assignment()` returns early at line 167-168 due to the `if not
self.__consumption: return` check
3. No message queue assignments are fetched, no messages are received
**Fix:**
Move `reset_setting()` outside the metric check to ensure it is always
called when settings are received:
```python
# After
if res.settings:
if res.settings.metric:
self.__handler.reset_metric(res.settings.metric)
self.__handler.reset_setting(res.settings)
```
### How Did You Test This Change?
1. Set up RocketMQ 5.1.4 (NameServer + Broker + Proxy) using Docker
2. Ran the reproduction script from #1168 before and after the fix
3. Verified that `PushConsumer` now receives messages correctly
**Before fix:**
```
PushConsumer: 0 messages
SimpleConsumer: 5 messages
```
**After fix:**
```
PushConsumer: 5 messages
SimpleConsumer: 5 messages
```
--
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]