RocketMq发送消息问题
public void asyncSendMessageTest() throws InterruptedException {
Message message = MessageBuilder.withPayload("测试异步消息").build();
rocketMQTemplate.asyncSend("topic3", message, new SendCallback() {
@Override
public void onSuccess(SendResult sendResult) {
log.info("asyncSendResult:" + sendResult);
}
@Override
public void onException(Throwable e) {
log.info("asyncSendResult:" + e);
}
});
Thread.sleep(50000);
}
2022-07-31 09:55:52.737 INFO 9196 --- [enderExecutor_1] c.y.producer.ProducerApplicationTests : asyncSendResult:org.apache.rocketmq.client.exception.MQClientException: Send [1] times, still failed, cost [3050]ms, Topic: topic3, BrokersSent: [MS-XCWWDZXWLRFO]
See http://rocketmq.apache.org/docs/faq/ for further details.
//以上是异步消息报错,以下是单向消息报错
Caused by: org.apache.rocketmq.client.exception.MQClientException: Send [1] times, still failed, cost [3493]ms, Topic: topic3, BrokersSent: [MS-XCWWDZXWLRFO]
See http://rocketmq.apache.org/docs/faq/ for further details.
Caused by: org.apache.rocketmq.remoting.exception.RemotingTooMuchRequestException: sendKernelImpl call timeout
同步消息是可以运行成功的,就异步消息和单向消息运行不成功。
麻烦有懂的大lao给解决以下,已经头疼1天了。
应该是你的服务端有问题,重新安装一下RocketMQ服务试试
我的问题是同步测试成功后,用异步,或者单向都会报错,然后再回去用同步也报错了,我是引入的依赖,然后用的容器中的rocketMQTemplate对象,最后解决方法,就是在方法中填了这个代码rocketMQTemplate.getProducer().setVipChannelEnabled(false);
感谢给我回答问题的呢个大佬,给我查了好久的资料,跪谢!!!