Java Code Examples for org.apache.rocketmq.common.message.MessageQueue

The following examples show how to use org.apache.rocketmq.common.message.MessageQueue. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Test
public void testTwoConsumerSubTag() {
    int msgSize = 10;

    RMQBroadCastConsumer consumer1 = getBroadCastConsumer(nsAddr, topic, "*",
        new RMQOrderListener());
    RMQBroadCastConsumer consumer2 = getBroadCastConsumer(nsAddr,
        consumer1.getConsumerGroup(), topic, "*", new RMQOrderListener());
    TestUtils.waitForSeconds(waitTime);

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    consumer1.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);
    consumer2.getListner().waitForMessageConsume(producer.getAllMsgBody(), consumeTime);

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListner()).getMsgs()))
        .isEqualTo(true);
    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListner()).getMsgs()))
        .isEqualTo(true);
}
 
Example 2
Source Project: DDMQ   Source File: BatchMQProducer.java    License: Apache License 2.0 6 votes vote down vote up
public void send(CarreraRequest request, MessageQueueSelector messageQueueSelector)
    throws RemotingException, MQClientException, InterruptedException, MQBrokerException {
    TopicPublishInfo topicInfo = clusterProducer.getRocketMQProducerByIndex(0).getDefaultMQProducerImpl().getTopicPublishInfoTable().get(request.getTopic());
    if (topicInfo == null || !topicInfo.ok()) { //new topic
        sendSingleMessage(request);
        return;
    }

    MessageQueue mq = messageQueueSelector.select(topicInfo.getMessageQueueList(), null, request);
    request.setMessageQueue(mq);

    requestQMap.computeIfAbsent(mq.getBrokerName(), _name -> {
        Deque<CarreraRequest> q = new ConcurrentLinkedDeque<>();
        addRequestQueue(q, _name, config.getMaxEncodeWorkerForEachBroker());
        return q;
    }).add(request);
}
 
Example 3
Source Project: rocketmq-read   Source File: RemoteBrokerOffsetStore.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void updateOffset(MessageQueue mq, long offset, boolean increaseOnly) {
    if (mq != null) {
        AtomicLong offsetOld = this.offsetTable.get(mq);
        if (null == offsetOld) {
            offsetOld = this.offsetTable.putIfAbsent(mq, new AtomicLong(offset));
        }

        if (null != offsetOld) {
            if (increaseOnly) {
                MixAll.compareAndIncreaseOnly(offsetOld, offset);
            } else {
                offsetOld.set(offset);
            }
        }
    }
}
 
Example 4
Source Project: rocketmq-4.3.0   Source File: SendMessageCommandTest.java    License: Apache License 2.0 6 votes vote down vote up
@BeforeClass
public static void init() throws MQClientException, RemotingException, InterruptedException, MQBrokerException, NoSuchFieldException, IllegalAccessException {

    DefaultMQProducer defaultMQProducer = mock(DefaultMQProducer.class);
    SendResult sendResult = new SendResult();
    sendResult.setMessageQueue(new MessageQueue());
    sendResult.getMessageQueue().setBrokerName("broker1");
    sendResult.getMessageQueue().setQueueId(1);
    sendResult.setSendStatus(SendStatus.SEND_OK);
    sendResult.setMsgId("fgwejigherughwueyutyu4t4343t43");

    when(defaultMQProducer.send(any(Message.class))).thenReturn(sendResult);
    when(defaultMQProducer.send(any(Message.class), any(MessageQueue.class))).thenReturn(sendResult);

    Field producerField = SendMessageCommand.class.getDeclaredField("producer");
    producerField.setAccessible(true);
    producerField.set(sendMessageCommand, defaultMQProducer);
}
 
Example 5
Source Project: rocketmq   Source File: MQAdminImpl.java    License: Apache License 2.0 6 votes vote down vote up
public Set<MessageQueue> fetchSubscribeMessageQueues(String topic) throws MQClientException {
    try {
        TopicRouteData topicRouteData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, timeoutMillis);
        if (topicRouteData != null) {
            Set<MessageQueue> mqList = MQClientInstance.topicRouteData2TopicSubscribeInfo(topic, topicRouteData);
            if (!mqList.isEmpty()) {
                return mqList;
            } else {
                throw new MQClientException("Can not find Message Queue for this topic, " + topic + " Namesrv return empty", null);
            }
        }
    } catch (Exception e) {
        throw new MQClientException(
            "Can not find Message Queue for this topic, " + topic + FAQUrl.suggestTodo(FAQUrl.MQLIST_NOT_EXIST), //
            e);
    }

    throw new MQClientException("Unknow why, Can not find Message Queue for this topic, " + topic, null);
}
 
Example 6
Source Project: rocketmq-4.3.0   Source File: RebalanceImpl.java    License: Apache License 2.0 6 votes vote down vote up
private void truncateMessageQueueNotMyTopic() {
//        获取订阅信息
        Map<String, SubscriptionData> subTable = this.getSubscriptionInner();

//        遍历处理队列
        for (MessageQueue mq : this.processQueueTable.keySet()) {
            if (!subTable.containsKey(mq.getTopic())) {

//                删除处理队列
                ProcessQueue pq = this.processQueueTable.remove(mq);
                if (pq != null) {
                    pq.setDropped(true);
                    log.info("doRebalance, {}, truncateMessageQueueNotMyTopic remove unnecessary mq, {}", consumerGroup, mq);
                }
            }
        }
    }
 
Example 7
Source Project: rocketmq   Source File: MQAdminImpl.java    License: Apache License 2.0 6 votes vote down vote up
public long searchOffset(MessageQueue mq, long timestamp) throws MQClientException {
    String brokerAddr = this.mQClientFactory.findBrokerAddressInPublish(mq.getBrokerName());
    if (null == brokerAddr) {
        this.mQClientFactory.updateTopicRouteInfoFromNameServer(mq.getTopic());
        brokerAddr = this.mQClientFactory.findBrokerAddressInPublish(mq.getBrokerName());
    }

    if (brokerAddr != null) {
        try {
            return this.mQClientFactory.getMQClientAPIImpl().searchOffset(brokerAddr, mq.getTopic(), mq.getQueueId(), timestamp,
                timeoutMillis);
        } catch (Exception e) {
            throw new MQClientException("Invoke Broker[" + brokerAddr + "] exception", e);
        }
    }

    throw new MQClientException("The broker[" + mq.getBrokerName() + "] not exist", null);
}
 
Example 8
Source Project: rocketmq   Source File: DefaultMQAdminExtImpl.java    License: Apache License 2.0 6 votes vote down vote up
public Map<MessageQueue, Long> resetOffsetByTimestamp(String topic, String group, long timestamp, boolean isForce,
    boolean isC)
    throws RemotingException, MQBrokerException, InterruptedException, MQClientException {
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    List<BrokerData> brokerDatas = topicRouteData.getBrokerDatas();
    Map<MessageQueue, Long> allOffsetTable = new HashMap<MessageQueue, Long>();
    if (brokerDatas != null) {
        for (BrokerData brokerData : brokerDatas) {
            String addr = brokerData.selectBrokerAddr();
            if (addr != null) {
                Map<MessageQueue, Long> offsetTable =
                    this.mqClientInstance.getMQClientAPIImpl().invokeBrokerToResetOffset(addr, topic, group, timestamp, isForce,
                        timeoutMillis, isC);
                if (offsetTable != null) {
                    allOffsetTable.putAll(offsetTable);
                }
            }
        }
    }
    return allOffsetTable;
}
 
Example 9
Source Project: DDMQ   Source File: RMQNormalProducer.java    License: Apache License 2.0 5 votes vote down vote up
public SendResult sendMQ(Message msg, MessageQueue mq) {
    org.apache.rocketmq.client.producer.SendResult metaqResult = null;
    try {
        long start = System.currentTimeMillis();
        metaqResult = producer.send(msg, mq);
        this.msgRTs.addData(System.currentTimeMillis() - start);
        if (isDebug) {
            logger.info(metaqResult);
        }
        sendResult.setMsgId(metaqResult.getMsgId());
        sendResult.setSendResult(metaqResult.getSendStatus().equals(SendStatus.SEND_OK));
        sendResult.setBrokerIp(metaqResult.getMessageQueue().getBrokerName());
        msgBodys.addData(new String(msg.getBody()));
        originMsgs.addData(msg);
        originMsgIndex.put(new String(msg.getBody()), metaqResult);
    } catch (Exception e) {
        if (isDebug) {
            e.printStackTrace();
        }

        sendResult.setSendResult(false);
        sendResult.setSendException(e);
        errorMsgs.addData(msg);
    }

    return sendResult;
}
 
Example 10
Source Project: rocketmq-4.3.0   Source File: OneWaySendExceptionIT.java    License: Apache License 2.0 5 votes vote down vote up
@Test(expected = org.apache.rocketmq.client.exception.MQClientException.class)
public void testSelectorThrowsException() throws Exception {
    Message msg = new Message(topic, RandomUtils.getStringByUUID().getBytes());
    DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr);
    producer.sendOneway(msg, new MessageQueueSelector() {
        @Override
        public MessageQueue select(List<MessageQueue> list, Message message, Object o) {
            String str = null;
            return list.get(str.length());
        }
    }, null);
}
 
Example 11
private void submitConsumeRequestLater(//
    final List<MessageExt> msgs, //
    final ProcessQueue processQueue, //
    final MessageQueue messageQueue//
) {

    this.scheduledExecutorService.schedule(new Runnable() {

        @Override
        public void run() {
            ConsumeMessageConcurrentlyService.this.submitConsumeRequest(msgs, processQueue, messageQueue, true);
        }
    }, 5000, TimeUnit.MILLISECONDS);
}
 
Example 12
Source Project: rocketmq   Source File: AsyncSendExceptionIT.java    License: Apache License 2.0 5 votes vote down vote up
@Test(expected = java.lang.NullPointerException.class)
public void testSendMQNull() throws Exception {
    Message msg = new Message(topic, RandomUtils.getStringByUUID().getBytes());
    DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr);
    MessageQueue messageQueue = null;
    producer.send(msg, messageQueue, SendCallBackFactory.getSendCallBack());
}
 
Example 13
Source Project: rocketmq-read   Source File: RemoteBrokerOffsetStoreTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testUpdateOffset() throws Exception {
    OffsetStore offsetStore = new RemoteBrokerOffsetStore(mQClientFactory, group);
    MessageQueue messageQueue = new MessageQueue(topic, brokerName, 1);

    offsetStore.updateOffset(messageQueue, 1024, false);
    assertThat(offsetStore.readOffset(messageQueue, ReadOffsetType.READ_FROM_MEMORY)).isEqualTo(1024);

    offsetStore.updateOffset(messageQueue, 1023, false);
    assertThat(offsetStore.readOffset(messageQueue, ReadOffsetType.READ_FROM_MEMORY)).isEqualTo(1023);

    offsetStore.updateOffset(messageQueue, 1022, true);
    assertThat(offsetStore.readOffset(messageQueue, ReadOffsetType.READ_FROM_MEMORY)).isEqualTo(1023);
}
 
Example 14
Source Project: rocketmq   Source File: RebalanceImpl.java    License: Apache License 2.0 5 votes vote down vote up
public boolean lock(final MessageQueue mq) {
    FindBrokerResult findBrokerResult = this.mQClientFactory.findBrokerAddressInSubscribe(mq.getBrokerName(), MixAll.MASTER_ID, true);
    if (findBrokerResult != null) {
        LockBatchRequestBody requestBody = new LockBatchRequestBody();
        requestBody.setConsumerGroup(this.consumerGroup);
        requestBody.setClientId(this.mQClientFactory.getClientId());
        requestBody.getMqSet().add(mq);

        try {
            Set<MessageQueue> lockedMq =
                this.mQClientFactory.getMQClientAPIImpl().lockBatchMQ(findBrokerResult.getBrokerAddr(), requestBody, 1000);
            for (MessageQueue mmqq : lockedMq) {
                ProcessQueue processQueue = this.processQueueTable.get(mmqq);
                if (processQueue != null) {
                    processQueue.setLocked(true);
                    processQueue.setLastLockTimestamp(System.currentTimeMillis());
                }
            }

            boolean lockOK = lockedMq.contains(mq);
            log.info("the message queue lock {}, {} {}",
                lockOK ? "OK" : "Failed",
                this.consumerGroup,
                mq);
            return lockOK;
        } catch (Exception e) {
            log.error("lockBatchMQ exception, " + mq, e);
        }
    }

    return false;
}
 
Example 15
Source Project: rocketmq   Source File: RebalanceLitePullImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void messageQueueChanged(String topic, Set<MessageQueue> mqAll, Set<MessageQueue> mqDivided) {
    MessageQueueListener messageQueueListener = this.litePullConsumerImpl.getDefaultLitePullConsumer().getMessageQueueListener();
    if (messageQueueListener != null) {
        try {
            messageQueueListener.messageQueueChanged(topic, mqAll, mqDivided);
        } catch (Throwable e) {
            log.error("messageQueueChanged exception", e);
        }
    }
}
 
Example 16
Source Project: DDMQ   Source File: RandomAsyncCommit.java    License: Apache License 2.0 5 votes vote down vote up
public void putMessages(final MessageQueue mq, final List<MessageExt> msgs) {
    CachedQueue cachedQueue = this.mqCachedTable.get(mq);
    if (null == cachedQueue) {
        cachedQueue = new CachedQueue();
        this.mqCachedTable.put(mq, cachedQueue);
    }
    for (MessageExt msg : msgs) {
        cachedQueue.getMsgCachedTable().put(msg.getQueueOffset(), msg);
    }
}
 
Example 17
@Test
public void testReportConsumerRunningInfo() {
    TreeMap<String, ConsumerRunningInfo> criTable = new TreeMap<>();
    ConsumerRunningInfo consumerRunningInfo = new ConsumerRunningInfo();
    consumerRunningInfo.setSubscriptionSet(new TreeSet<SubscriptionData>());
    consumerRunningInfo.setStatusTable(new TreeMap<String, ConsumeStatus>());
    consumerRunningInfo.setSubscriptionSet(new TreeSet<SubscriptionData>());
    consumerRunningInfo.setMqTable(new TreeMap<MessageQueue, ProcessQueueInfo>());
    consumerRunningInfo.setProperties(new Properties());
    criTable.put("test", consumerRunningInfo);
    defaultMonitorListener.reportConsumerRunningInfo(criTable);
}
 
Example 18
Source Project: rocketmq   Source File: OrderMsgRebalanceIT.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testTwoConsumersBalance() {
    int msgSize = 10;
    RMQNormalConsumer consumer1 = getConsumer(nsAddr, topic, "*", new RMQOrderListener());
    RMQNormalConsumer consumer2 = getConsumer(nsAddr, consumer1.getConsumerGroup(), topic,
        "*", new RMQOrderListener());
    TestUtils.waitForSeconds(waitTime);

    List<MessageQueue> mqs = producer.getMessageQueue();
    MessageQueueMsg mqMsgs = new MessageQueueMsg(mqs, msgSize);
    producer.send(mqMsgs.getMsgsWithMQ());

    boolean recvAll = MQWait.waitConsumeAll(consumeTime, producer.getAllMsgBody(),
        consumer1.getListener(), consumer2.getListener());
    assertThat(recvAll).isEqualTo(true);

    boolean balance = VerifyUtils.verifyBalance(producer.getAllMsgBody().size(),
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer1.getListener().getAllUndupMsgBody()).size(),
        VerifyUtils.getFilterdMessage(producer.getAllMsgBody(),
            consumer2.getListener().getAllUndupMsgBody()).size());
    assertThat(balance).isEqualTo(true);

    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer1.getListener()).getMsgs()))
        .isEqualTo(true);
    assertThat(VerifyUtils.verifyOrder(((RMQOrderListener) consumer2.getListener()).getMsgs()))
        .isEqualTo(true);
}
 
Example 19
Source Project: rocketmq   Source File: DefaultMQPushConsumerImpl.java    License: Apache License 2.0 5 votes vote down vote up
public Set<MessageQueue> parseSubscribeMessageQueues(Set<MessageQueue> messageQueueList) {
    Set<MessageQueue> resultQueues = new HashSet<MessageQueue>();
    for (MessageQueue queue : messageQueueList) {
        String userTopic = NamespaceUtil.withoutNamespace(queue.getTopic(), this.defaultMQPushConsumer.getNamespace());
        resultQueues.add(new MessageQueue(userTopic, queue.getBrokerName(), queue.getQueueId()));
    }

    return resultQueues;
}
 
Example 20
Source Project: rocketmq-4.3.0   Source File: DefaultMQProducerImpl.java    License: Apache License 2.0 5 votes vote down vote up
/**
     * KERNEL ONEWAY -------------------------------------------------------
     */
//
    public void sendOneway(Message msg,
        MessageQueue mq) throws MQClientException, RemotingException, InterruptedException {
        this.makeSureStateOK();
        Validators.checkMessage(msg, this.defaultMQProducer);

        try {
            this.sendKernelImpl(msg, mq, CommunicationMode.ONEWAY, null, null, this.defaultMQProducer.getSendMsgTimeout());
        } catch (MQBrokerException e) {
            throw new MQClientException("unknown exception", e);
        }
    }
 
Example 21
Source Project: DDMQ   Source File: AsyncSendExceptionIT.java    License: Apache License 2.0 5 votes vote down vote up
@Test(expected = java.lang.NullPointerException.class)
public void testSendMQNull() throws Exception {
    Message msg = new Message(topic, RandomUtils.getStringByUUID().getBytes());
    DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr);
    MessageQueue messageQueue = null;
    producer.send(msg, messageQueue, SendCallBackFactory.getSendCallBack());
}
 
Example 22
Source Project: rocketmq   Source File: AssignedMessageQueue.java    License: Apache License 2.0 5 votes vote down vote up
public void removeAssignedMessageQueue(String topic) {
    synchronized (this.assignedMessageQueueState) {
        Iterator<Map.Entry<MessageQueue, MessageQueueState>> it = this.assignedMessageQueueState.entrySet().iterator();
        while (it.hasNext()) {
            Map.Entry<MessageQueue, MessageQueueState> next = it.next();
            if (next.getKey().getTopic().equals(topic)) {
                it.remove();
            }
        }
    }
}
 
Example 23
Source Project: DDMQ   Source File: OneWaySendExceptionIT.java    License: Apache License 2.0 5 votes vote down vote up
@Test(expected = java.lang.NullPointerException.class)
public void testSendMQNull() throws Exception {
    Message msg = new Message(topic, RandomUtils.getStringByUUID().getBytes());
    DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr);
    MessageQueue messageQueue = null;
    producer.sendOneway(msg, messageQueue);
}
 
Example 24
Source Project: rocketmq   Source File: CloneGroupOffsetCommand.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void execute(CommandLine commandLine, Options options, RPCHook rpcHook) {
    String srcGroup = commandLine.getOptionValue("s").trim();
    String destGroup = commandLine.getOptionValue("d").trim();
    String topic = commandLine.getOptionValue("t").trim();

    DefaultMQAdminExt defaultMQAdminExt = new DefaultMQAdminExt(rpcHook);
    defaultMQAdminExt.setInstanceName("admin-" + Long.toString(System.currentTimeMillis()));

    try {
        defaultMQAdminExt.start();
        ConsumeStats consumeStats = defaultMQAdminExt.examineConsumeStats(srcGroup);
        Set<MessageQueue> mqs = consumeStats.getOffsetTable().keySet();
        if (!mqs.isEmpty()) {
            TopicRouteData topicRoute = defaultMQAdminExt.examineTopicRouteInfo(topic);
            for (MessageQueue mq : mqs) {
                String addr = null;
                for (BrokerData brokerData : topicRoute.getBrokerDatas()) {
                    if (brokerData.getBrokerName().equals(mq.getBrokerName())) {
                        addr = brokerData.selectBrokerAddr();
                        break;
                    }
                }
                long offset = consumeStats.getOffsetTable().get(mq).getBrokerOffset();
                if (offset >= 0) {
                    defaultMQAdminExt.updateConsumeOffset(addr, destGroup, mq, offset);
                }
            }
        }
        System.out.printf("clone group offset success. srcGroup[%s], destGroup=[%s], topic[%s]",
            srcGroup, destGroup, topic);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        defaultMQAdminExt.shutdown();
    }
}
 
Example 25
@Test(expected = java.lang.NullPointerException.class)
public void testSendMQNull() throws Exception {
    Message msg = new Message(topic, RandomUtils.getStringByUUID().getBytes());
    DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr);
    MessageQueue messageQueue = null;
    producer.sendOneway(msg, messageQueue);
}
 
Example 26
public Object fetchLockObject(final MessageQueue mq) {
    Object objLock = this.mqLockTable.get(mq);
    if (null == objLock) {
        objLock = new Object();
        Object prevLock = this.mqLockTable.putIfAbsent(mq, objLock);
        if (prevLock != null) {
            objLock = prevLock;
        }
    }

    return objLock;
}
 
Example 27
Source Project: rocketmq-4.3.0   Source File: DefaultMQAdminExtImpl.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Map<String, Map<MessageQueue, Long>> getConsumeStatus(String topic, String group,
    String clientAddr) throws RemotingException,
    MQBrokerException, InterruptedException, MQClientException {
    TopicRouteData topicRouteData = this.examineTopicRouteInfo(topic);
    List<BrokerData> brokerDatas = topicRouteData.getBrokerDatas();
    if (brokerDatas != null && brokerDatas.size() > 0) {
        String addr = brokerDatas.get(0).selectBrokerAddr();
        if (addr != null) {
            return this.mqClientInstance.getMQClientAPIImpl().invokeBrokerToGetConsumerStatus(addr, topic, group, clientAddr,
                timeoutMillis);
        }
    }
    return Collections.EMPTY_MAP;
}
 
Example 28
Source Project: DDMQ   Source File: AsyncSendExceptionIT.java    License: Apache License 2.0 5 votes vote down vote up
@Test(expected = java.lang.NullPointerException.class)
public void testSendMQNull() throws Exception {
    Message msg = new Message(topic, RandomUtils.getStringByUUID().getBytes());
    DefaultMQProducer producer = ProducerFactory.getRMQProducer(nsAddr);
    MessageQueue messageQueue = null;
    producer.send(msg, messageQueue, SendCallBackFactory.getSendCallBack());
}
 
Example 29
public void printMessageQueue(List<MessageQueue> messageQueueList, String name) {
    if (messageQueueList == null || messageQueueList.size() < 1)
        return;
    System.out.println(name + ".......................................start");
    for (MessageQueue messageQueue : messageQueueList) {
        System.out.println(messageQueue);
    }
    System.out.println(name + ".......................................end");
}
 
Example 30
Source Project: DDMQ   Source File: MQAdminImpl.java    License: Apache License 2.0 5 votes vote down vote up
public List<MessageQueue> fetchPublishMessageQueues(String topic) throws MQClientException {
    try {
        TopicRouteData topicRouteData = this.mQClientFactory.getMQClientAPIImpl().getTopicRouteInfoFromNameServer(topic, timeoutMillis);
        if (topicRouteData != null) {
            TopicPublishInfo topicPublishInfo = MQClientInstance.topicRouteData2TopicPublishInfo(topic, topicRouteData);
            if (topicPublishInfo != null && topicPublishInfo.ok()) {
                return topicPublishInfo.getMessageQueueList();
            }
        }
    } catch (Exception e) {
        throw new MQClientException("Can not find Message Queue for this topic, " + topic, e);
    }

    throw new MQClientException("Unknow why, Can not find Message Queue for this topic, " + topic, null);
}