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

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

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

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

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

public class MessageProducer  {
    private DefaultMQProducer producer = new DefaultMQProducer();
    public MessageProducer() {
        producer.setNamesrvAddr("xxxxxx");
        producer.setProducerGroup("yxshi-request-copy-Group");
        try {
            producer.start();
            log.info("mq producer start success");
        } catch (MQClientException e) {
            log.error("", e);
        }
        producer.setRetryTimesWhenSendAsyncFailed(1);
    }
    public void send( Message message) {
        try {
               producer.send(message, new SendCallback() {
                @Override
                public void onSuccess(SendResult sendResult) {
                    log.info("send message success,{}", sendResult);
                }
                @Override
                public void onException(Throwable e) {
                    log.error("send mesage error,{}", e);
                }
            });
        } catch (Exception e) {
            log.error("send message failed", e);
        }
    }
    @PreDestroy
    public  void shutdown()throws Exception{
        producer.shutdown();
    }
}

暂无答案!

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

相关问题