com.alibaba.rocketmq.client.exception.MQClientException: Send [1] times, still failed, cost [696094]ms, Topic: TopicTest, BrokersSent: [broker-b, null]
See https://github.com/alibaba/RocketMQ/issues/50 for further details.
at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:578)
at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1031)
at com.alibaba.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1025)
at com.alibaba.rocketmq.client.producer.DefaultMQProducer.send(DefaultMQProducer.java:95)

关键代码片段

        final long maxTimeout = this.defaultMQProducer.getSendMsgTimeout() + 1000;
final long beginTimestamp = System.currentTimeMillis();
long endTimestamp = beginTimestamp;
TopicPublishInfo topicPublishInfo = this.tryToFindTopicPublishInfo(msg.getTopic());
if (topicPublishInfo != null && topicPublishInfo.ok()) {
MessageQueue mq = null;
Exception exception = null;
SendResult sendResult = null;
int timesTotal = 1 + this.defaultMQProducer.getRetryTimesWhenSendFailed();
int times = 0;
String[] brokersSent = new String[timesTotal];
for (; times < timesTotal && (endTimestamp - beginTimestamp) < maxTimeout; times++) {
String lastBrokerName = null == mq ? null : mq.getBrokerName();
MessageQueue tmpmq = topicPublishInfo.selectOneMessageQueue(lastBrokerName);
if (tmpmq != null) {
mq = tmpmq;
brokersSent[times] = mq.getBrokerName();
try {
sendResult = this.sendKernelImpl(msg, mq, communicationMode, sendCallback, timeout);
endTimestamp = System.currentTimeMillis();
switch (communicationMode) {
case ASYNC:
return null;
case ONEWAY:
return null;
case SYNC:
if (sendResult.getSendStatus() != SendStatus.SEND_OK) {
if (this.defaultMQProducer.isRetryAnotherBrokerWhenNotStoreOK()) {
continue;
}
} return sendResult;
default:
break;
}
}
catch ... //省略部分代码
}
else {
break;
}
} // end of for if (sendResult != null) {
return sendResult;
} String info =
String.format("Send [%d] times, still failed, cost [%d]ms, Topic: %s, BrokersSent: %s", //
times, //
(System.currentTimeMillis() - beginTimestamp), //
msg.getTopic(),//
Arrays.toString(brokersSent)); info += FAQUrl.suggestTodo(FAQUrl.SEND_MSG_FAILED); throw new MQClientException(info, exception);
}

1. 循环几次发送几次

2. selectOneMessageQueue 返回与上一个broker不同名的broker

3. timesTotal  是brokersSent 数组

4. 某broker发送失败时,如果想要重试其他broker,需要把retryAnotherBrokerWhenNotStoreOK设置为true(默认为false)

5. 最大超时时间是在超时时间基础上增加1s(坑?)

Send [1] times, still failed的更多相关文章

  1. Cannot send, channel has already failed:

    背景: 一个同事往这个队列发数据,另一个同事从这个队列取数据,进行解析. 这是昨天同事昨天消费者 消费activemq 队列,一开始有正常,运行了一段时间后,发现突然消费者变为零了.因为有监控.之后怎 ...

  2. org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed

    项目是使用activeMQ 发布订阅的模式,在本地测试正常,但是 放到服务器上出现这个错误: org.apache.activemq.transport.InactivityIOException: ...

  3. fwrite(): send of 8192 bytes failed with errno=104 Connection reset by peer

    问题:fwrite(): send of 8192 bytes failed with errno=104 Connection reset by peer 问题描述 通过mysql + sphinx ...

  4. PHP系列 | PDO::prepare(): send of 68 bytes failed with errno=32 Broken pipe

    设计场景 1.开启Redis的键空间过期事件(键过期发布任务),创建订单创建一个过期的key,按照订单号为key,设置过期时间. 2.通过Redis的订阅模式(持久阻塞),获取到订单号进行组装. 3. ...

  5. ActiveMQ Cannot send, channel has already failed: tcp:127.0.0.1:8161

    仅针对如下错误内容: Cannot send, channel has already failed: tcp://127.0.0.1:8161 一种尝试解决,修改连接端口为 61616: tcp:/ ...

  6. Cannot send, channel has already failed: tcp://127.0.0.1:8161

    解决方案一 我觉得你可能需要把服务完全停掉了 然后重启一下. http://localhost:8161(管理端口) tcp://127.0.0.1:61616(服务端口)

  7. rocketmq连接报connect to ip:10909 failed

    一.代码重现如下: 二.错误描述: com.alibaba.rocketmq.client.exception.MQClientException: Send [1] times, still fai ...

  8. C 基于socket实现简单的文件传输

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAicAAAA5CAIAAABicRxIAAAgAElEQVR4nOy9Z5NVV5om+rzL773POW

  9. linux下开发板网络速度测试记录

        由于做的项目对于网络和USB的读写速度有很高的要求,因此新拿回来的板子要测试网络和usb的最佳传输速度.要考虑不少因素,先把我能想到的记录下来.     测试的环境是开发板和ubuntu虚拟机 ...

随机推荐

  1. 后端渲染html、前端模板渲染html,jquery的html

    作者:赵魏璇链接:https://www.zhihu.com/question/28725977/answer/116177149来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注 ...

  2. codevs 计算器的改良

    #include<iostream> #include<cctype> #include<vector> #include<cstdio> using ...

  3. GNU Radio: 射频子板

    本文简要介绍 USRP 配套的子板参数信息. 射频子板WBX-40 性能特点 频率覆盖:50 MHz – 2.2GHz 最大信号处理带宽:40MHz 行为描述 WBX-40提供高宽带收发器,可提供高达 ...

  4. .NET实现WebSocket服务端即时通信实例

    即时通信常用手段 1.第三方平台 谷歌.腾讯 环信等多如牛毛,其中谷歌即时通信是免费的,但免费就是免费的并不好用.其他的一些第三方一般收费的,使用要则限流(1s/限制x条消息)要么则限制用户数. 但稳 ...

  5. 黄聪:mysql搬家,直接复制data文件夹(*.MYD,*.MYI,innodb)出错,无法正常显示

    解决办法: 1.复制旧mysql的data文件夹中的数据库到新mysql的data文件夹内. 2.删掉旧的“ib_logfile*”等日志文件,重启MySQL后会自动生成新的日志文件的. 3.复制旧的 ...

  6. [转]Web 调试工具之 Advanced REST client

    原文:http://bbs.itcast.cn/forum.php?mod=viewthread&tid=85654 安装方式: 3.1. 如果你能FQ访问谷歌商店,那么就简单了 在这里直接安 ...

  7. [Java.web]简单计算器

    项目的  WebRoot 目录下的 calculator.jsp <%@ page language="java" import="java.util.*" ...

  8. [html]CSS 小贴士

    CSS 中用四个伪类来定义链接的样式,分别是:a:link.a:visited.a:hover 和 a : active,例如: a:link{font-weight : bold ;text-dec ...

  9. 解决phpexcel保存时文件命中文出现 乱码 (这个真的有用)

    Phpexcel导出Excel文件时有两个主要的过程: 1.定义文件名 2.填充Excel数据 这两个过程中可能会出现一些乱码问题,下面我来说一下解决办法: 解决文件名的乱码: 乱码原因:客户使用的中 ...

  10. [Octave] fminunc()

    fminunc( FCN, X0); fminunc( FCN, C0, Options); [X, FVEC, INFO, OUTPUT, GRAD, HESS] = fminunc (FCN, . ...