开发者社区> 问答> 正文

RocketMQ拉不到数据

在本地获取的了数据,传上去就不行了。
我有三个Consumer,用的是广播模式,每个Consumer都订阅了三个Topic。

其中,Taobao的如下

DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(RaceConfig.MetaConsumerGroup);

            consumer.setConsumeFromWhere(ConsumeFromWhere.CONSUME_FROM_FIRST_OFFSET);

            //consumer.setNamesrvAddr(RaceConfig.MqAddr);

            consumer.setMessageModel(MessageModel.BROADCASTING);

            try {
                consumer.subscribe(RaceConfig.MqTaobaoTradeTopic, "*");
                consumer.subscribe(RaceConfig.MqTmallTradeTopic, "*");
                consumer.subscribe(RaceConfig.MqPayTopic, "*");

                consumer.registerMessageListener(new MessageListenerConcurrently() {

                    @Override
                    public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
                                                                    ConsumeConcurrentlyContext context) {
                        for (MessageExt msg : msgs) {
                            if (!msg.getTopic().equals(RaceConfig.MqTaobaoTradeTopic)) {
                                continue;
                            }

                            //do something

                        }
                        return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
                    }
                });

                consumer.start();
            }
            catch (MQClientException e) {
                // ignore;
                e.printStackTrace();
            }

            System.out.println("Consumer Started.");


展开
收起
m18446744 2016-07-02 20:38:00 4909 0
3 条回答
写回答
取消 提交回答
  • I like to program and write stuff, making things a reality always make me excited. Now, I am a Apache committer.
    你用的是广播模式?
    2016-07-08 09:30:23
    赞同 展开评论 打赏
  • ReRocketMQ拉不到数据
    setNamesrvAdd是不是不应该设置
    2016-07-07 23:45:14
    赞同 展开评论 打赏
  • ReRocketMQ拉不到数据
    你好,你解决了吗
    2016-07-07 20:14:15
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
RocketMQ Client-GO 介绍 立即下载
RocketMQ Prometheus Exporter 打造定制化 DevOps 平台 立即下载
基于 RocketMQ Prometheus Exporter 打造定制化 DevOps 平台 立即下载