[Enhancement] Make ReceiveMessageQueueSelector broker-sticky for reentrant orderly POP
type/enhancement
### Before Creating the Enhancement Request
- [x] I have confirmed that this should be classified as an enhancement rather than a bug/feature.
### Summary
Reentrant orderly consumption (#6755) relies on a client retry (same attemptId) being routed back to **the same** broker, since OrderInfo and its attemptId match are broker-local state (QueueLevelConsumerManager.needBlock).
However, in ```ReceiveMessageActivity.ReceiveMessageQueueSelector#select```, when the requested broker is not availabe(eg: in a rolling update), it silently falls back to round-robins to an other one.
```
protected static class ReceiveMessageQueueSelector implements QueueSelector {
private final String brokerName;
public ReceiveMessageQueueSelector(String brokerName) {
this.brokerName = brokerName;
}
@Override
public AddressableMessageQueue select(ProxyContext ctx, MessageQueueView messageQueueView) {
try {
AddressableMessageQueue addressableMessageQueue = null;
MessageQueueSelector messageQueueSelector = messageQueueView.getReadSelector();
if (StringUtils.isNotBlank(brokerName)) {
addressableMessageQueue = messageQueueSelector.getQueueByBrokerName(brokerName);
}
if (addressableMessageQueue == null) {
addressableMessageQueue = messageQueueSelector.selectOne(true);
}
return addressableMessageQueue;
} catch (Throwable t) {
return null;
}
}
}
```
### Motivation
Avoid losing reentrancy and thus leaving the FIFO queue blocked until invisibleTime expires.
### Describe the Solution You'd Like
Make the selector broker-sticky, especially on a FIFO request carrying an attemptId.
### Describe Alternatives You've Considered
-
### Additional Context
_No response_
0 条评论