整合RocketMq提示RemotingTooMuchRequestException: sendDefaultImpl call timeout
程序员文章站
2022-07-14 23:04:45
...
在云服务器上安装RocketMq后,项目整合测试
启动好nameServer和Broker之后, 启动生产者会报这样的错误
Exception in thread "main" org.apache.rocketmq.remoting.exception.RemotingTooMuchRequestException: sendDefaultImpl call timeout
at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:588)
at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1223)
at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1173)
at org.apache.rocketmq.client.producer.DefaultMQProducer.send(DefaultMQProducer.java:214)
at com.baojian.mob.base.producer.SyncProducer.main(SyncProducer.java:41)
15:22:31.455 [NettyClientSelector_1] INFO RocketmqRemoting - closeChannel: close the connection to remote address[] result: true
15:22:32.049 [NettyClientSelector_1] INFO RocketmqRemoting - closeChannel: close the connection to remote address[] result: true
原因: BrokerIP展示的是云服务器的本地IP,不是公网IP;
解决方法:
在conf/broker.conf 中 加入 两行配置
namesrvAddr = 你的公网IP:9876
brokerIP1=你的公网IP
重新启动 broker
启动broker的指令要修改下, 要将这个配置文件指定加载
nohup sh mqbroker -n localhost:9876 -c ../conf/broker.conf autoCreateTopicEnable=true &