Send [1] times, still failed
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的更多相关文章
- Cannot send, channel has already failed:
背景: 一个同事往这个队列发数据,另一个同事从这个队列取数据,进行解析. 这是昨天同事昨天消费者 消费activemq 队列,一开始有正常,运行了一段时间后,发现突然消费者变为零了.因为有监控.之后怎 ...
- org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed
项目是使用activeMQ 发布订阅的模式,在本地测试正常,但是 放到服务器上出现这个错误: org.apache.activemq.transport.InactivityIOException: ...
- 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 ...
- PHP系列 | PDO::prepare(): send of 68 bytes failed with errno=32 Broken pipe
设计场景 1.开启Redis的键空间过期事件(键过期发布任务),创建订单创建一个过期的key,按照订单号为key,设置过期时间. 2.通过Redis的订阅模式(持久阻塞),获取到订单号进行组装. 3. ...
- 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:/ ...
- Cannot send, channel has already failed: tcp://127.0.0.1:8161
解决方案一 我觉得你可能需要把服务完全停掉了 然后重启一下. http://localhost:8161(管理端口) tcp://127.0.0.1:61616(服务端口)
- rocketmq连接报connect to ip:10909 failed
一.代码重现如下: 二.错误描述: com.alibaba.rocketmq.client.exception.MQClientException: Send [1] times, still fai ...
- C 基于socket实现简单的文件传输
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAicAAAA5CAIAAABicRxIAAAgAElEQVR4nOy9Z5NVV5om+rzL773POW
- linux下开发板网络速度测试记录
由于做的项目对于网络和USB的读写速度有很高的要求,因此新拿回来的板子要测试网络和usb的最佳传输速度.要考虑不少因素,先把我能想到的记录下来. 测试的环境是开发板和ubuntu虚拟机 ...
随机推荐
- Chrome 上传时打开对话框非常慢
Chrome 上传时打开对话框非常慢 先说解决方法,将 Chrome 中这个选项关闭,打开会飞快. 如果只是图片之类是不会的,但是有 zip apk 之类的就会慢. 主要原因还是 Chrome 太安全 ...
- 【转】Linux下的文本dos格式转Unix格式,去除^M符号
原文网址:http://blog.csdn.net/kobejayandy/article/details/13291525 问:我在Windows中通过FTP传一个文本文件到Linux中,但是打开文 ...
- UOJ 348 【WC2018】州区划分——子集卷积
题目:http://uoj.ac/problem/348 参考:https://www.cnblogs.com/NaVi-Awson/p/9242645.html#%E5%AD%90%E9%9B%86 ...
- 推荐一个React 入门的教程
推荐一个React 入门的教程 react 入门实例教程 Github地址:https://github.com/ruanyf/react-demos
- (转)C#与Outlook交互收发邮件
本文转载自:http://www.cnblogs.com/Moosdau/archive/2012/03/11/2390729.html .Net对POP3邮件系统已经集成了相应的功能,但是如果是基于 ...
- jquery.raty.js 评星插件的使用
需要实现一个五星好评的功能,所以找到了这个JQ插件,使用起来还算简单,在这里记录下使用的方式. 第一步:导入这个插件和压缩包中的img文件夹 <script type="text/ja ...
- Windows RDP远程连接CentOS 7
1. 打开已经安装了CentOS7的主机,以root用户登录,在桌面上打开一个终端,输入命令:rpm -qa|grep epel,查询是否已经安装epel库(epel是社区强烈打造的免费开源发行软 ...
- sqoop导出到mysql中文乱码问题总结、utf8、gbk
sqoop导出到mysql中文乱码问题总结.utf8.gbk 今天使用sqoop1.4.5版本的(hadoop使用cdh5.4)因为乱码问题很是头痛半天.下面进行一一总结 命令: [root@sdzn ...
- snmp获取设备相关管理信息
在本文中,作者将向我们展示如何用snmp代理监视网络设备,甚至发送软件警告. 网络上很多代理在为我们服务.只要我们开启UDP/161,162端口,这些代理就会以Management Informati ...
- django2.0实现数据详情页展示的流程
思路整理 1 先在urls.py中,定义路由获取的格式 url(r'^detail/(\d+)/$', views.blog_detail), 2 然后在views.py,定义数据获取的方法 def ...