apache / rocketmq

Apache RocketMQ is a cloud native messaging and streaming platform, making it simple to build event-driven applications.
https://rocketmq.apache.org/
Apache License 2.0
21.19k stars 11.67k forks source link

Remove duplicate code in TopicPublishInfo #6398

Open zyx333 opened 1 year ago

zyx333 commented 1 year ago

The code block below in the selectOneMessageQueue method is identical to another overloaded method (2nd code block).

https://github.com/apache/rocketmq/blob/7d6748445617dea43bc8c2c0410292e2eb423dc1/client/src/main/java/org/apache/rocketmq/client/impl/producer/TopicPublishInfo.java#L74-L76

https://github.com/apache/rocketmq/blob/7d6748445617dea43bc8c2c0410292e2eb423dc1/client/src/main/java/org/apache/rocketmq/client/impl/producer/TopicPublishInfo.java#L85-L90

IMO, it can be rewritten like this.

for (int i = 0; i < this.messageQueueList.size(); i++) {
         MessageQueue mq = selectOneMessageQueue()
         if (!mq.getBrokerName().equals(lastBrokerName)) {
               return mq;
         }
 }

If it's acceptable, I will submit a pull request.

Oliverwqcwrw commented 1 year ago

IMO, It's a good idea, welcome your PR :-)

AdityaP7649 commented 1 year ago

Hi there! I'm interested in working on this issue. It aligns with my skills. Could you please assign this issue to me, or guide me on how to get started? Thanks!

benedikt-roth commented 1 year ago

@Oliverwqcwrw I would like to work on this in case it is not picked up yet.

farukhfrk commented 1 year ago

I would like to work on this, Could you please assign it to me?

ThestralWarrior commented 10 months ago

i see this hasn't been assigned yet, can I work on this?

bitWizrd commented 9 months ago

@Oliverwqcwrw Kindly to ask if there is somebody working for this issue? lf not, I'm glad to undertake it.

Oliverwqcwrw commented 9 months ago

Thank you very much for your attention to the community, I noticed that the latest code has changed, please take a look at the latest code to check whether the problem still exists :)

ling0900 commented 5 months ago

Is it possible for this issue to be closed in the near future? If not, I'll try to follow up on it.