问题遇到的现象和发生背景
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天了。