Swapnapratim opened a new pull request, #6499: URL: https://github.com/apache/rocketmq/pull/6499
To clarify, while there is indeed some duplicated code between the two selectOneMessageQueue methods, there are some differences as well, particularly in the handling of the lastBrokerName argument. Therefore, simply merging the two methods into one may not be the best solution in this case. However, there are still some opportunities to refactor the code to reduce duplication. One option could be to extract the common code into a private helper method, which both selectOneMessageQueue methods can call as needed. In this refactored version, the selectOneMessageQueue methods now simply call a private helper method, passing in null or the lastBrokerName argument as appropriate. The helper method contains the common code for selecting a message queue, including the loop, incrementing the queue index, and checking whether the broker name matches the given parameter. Note that in the refactored version, I also added a fallback option. -- 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]
