rocketmq icon indicating copy to clipboard operation
rocketmq copied to clipboard

Make sure the list of message queues is not null before using selecting a queue. in orderly message sending example.

Open ShannonDing opened this issue 3 years ago • 7 comments

in example/ordermessage/producer.java. make sure message queue is not null before using selecting a queue.

SendResult sendResult = producer.send(msg, new MessageQueueSelector() {
       @Override
        public MessageQueue select(List<MessageQueue> mqs, Message msg, Object arg) {
        Integer id = (Integer) arg;
        int index = id % mqs.size();
        return mqs.get(index);
       }
 }, orderId);

if the mqs is null, mqs.size() may be crash.

ShannonDing avatar Nov 30 '21 12:11 ShannonDing

please assign this work to me.

chenlong1993 avatar Nov 30 '21 14:11 chenlong1993

please assign this work to me.

Welcome. assigned.

ShannonDing avatar Dec 01 '21 01:12 ShannonDing

ping @clbigdata

ShannonDing avatar Dec 08 '21 03:12 ShannonDing

@ShannonDing The main process of sending message is in method org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl#sendSelectImpl.

The topicPublishInfo.ok() is called before calling MessageQueueSelector#select, what any else situation will cause the empty message queue list?

devfat avatar Jan 04 '22 16:01 devfat

@devfat you are right

zhiliatom avatar Mar 29 '22 16:03 zhiliatom

So, this issue can be closed,right?

acmday avatar Apr 22 '22 01:04 acmday

So, this issue can be closed,right?

@ShannonDing

sunheyi6 avatar Jul 28 '22 05:07 sunheyi6