rocketmq icon indicating copy to clipboard operation
rocketmq copied to clipboard

Remove duplicate code in TopicPublishInfo

Open zyx333 opened this issue 2 years ago • 8 comments

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.

zyx333 avatar Mar 19 '23 15:03 zyx333

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

Oliverwqcwrw avatar Mar 20 '23 00:03 Oliverwqcwrw

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!

AdityaPatil22 avatar Sep 27 '23 15:09 AdityaPatil22

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

benedikt-roth avatar Oct 10 '23 17:10 benedikt-roth

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

farukhfrk avatar Oct 16 '23 11:10 farukhfrk

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

ThestralWarrior avatar Dec 12 '23 05:12 ThestralWarrior

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

bitWizrd avatar Jan 06 '24 16:01 bitWizrd

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 :)

Oliverwqcwrw avatar Jan 07 '24 12:01 Oliverwqcwrw

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

lingmeme avatar May 22 '24 05:05 lingmeme