为什么rocketmq生产者消息抛出等待响应超时0毫秒

dpiehjr4  于 2021-06-30  发布在  Java
关注(0)|答案(0)|浏览(532)

你好,有人能帮我吗?当我把消息发到broker fast时,我得到以下例外:

  1. org.apache.rocketmq.client.exception.MQClientException: wait response
  2. timeout 0ms For more information, please visit the url,
  3. http://rocketmq.apache.org/docs/faq/ at
  4. org.apache.rocketmq.client.impl.MQClientAPIImpl$1.operationComplete(MQClientAPIImpl.java:416)
  5. at
  6. org.apache.rocketmq.remoting.netty.ResponseFuture.executeInvokeCallback(ResponseFuture.java:51)
  7. at
  8. org.apache.rocketmq.remoting.netty.NettyRemotingAbstract$2.run(NettyRemotingAbstract.java:286)
  9. at
  10. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  11. at java.util.concurrent.FutureTask.run(FutureTask.java:266) at
  12. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  13. at
  14. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  15. at java.lang.Thread.run(Thread.java:748)

我看了源代码,但没有找到原因,为什么是超时0毫秒?我没有单独设置超时时间,超时时间应该是默认的3000ms。
我的制片人配置是:

  1. public class MessageProducer {
  2. private DefaultMQProducer producer = new DefaultMQProducer();
  3. public MessageProducer() {
  4. producer.setNamesrvAddr("xxxxxx");
  5. producer.setProducerGroup("yxshi-request-copy-Group");
  6. try {
  7. producer.start();
  8. log.info("mq producer start success");
  9. } catch (MQClientException e) {
  10. log.error("", e);
  11. }
  12. producer.setRetryTimesWhenSendAsyncFailed(1);
  13. }
  14. public void send( Message message) {
  15. try {
  16. producer.send(message, new SendCallback() {
  17. @Override
  18. public void onSuccess(SendResult sendResult) {
  19. log.info("send message success,{}", sendResult);
  20. }
  21. @Override
  22. public void onException(Throwable e) {
  23. log.error("send mesage error,{}", e);
  24. }
  25. });
  26. } catch (Exception e) {
  27. log.error("send message failed", e);
  28. }
  29. }
  30. @PreDestroy
  31. public void shutdown()throws Exception{
  32. producer.shutdown();
  33. }
  34. }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题