版本: 4.6.1 OS: Centos 部署方式:一主一从
问题描述: 采用DefaultMQProducer的异步发送方式,client端执行完send后,broker端无该消息的任何信息,本地也无任何响应回调,当时broker服务器上的cpu和内存也正常,查看了client,remoting,broker的日志也没有该消息的任何踪迹。
请问一下,这种情况的可能原因是什么?遇到这种问题从哪里入手查找? 谢谢
producer code
@PostConstruct public void init(){ producer = new DefaultMQProducer("PRODUCER_GROUP"); producer.setNamespace(namesrvAddr); producer.setRetryTimesWhenSendAsyncFailed(3);
try {
producer.start();
} catch (MQClientException e) {
logger.error("========> errMsg:{}", e.getMessage(), e);
}
logger.info("--------> producer group:PRODUCER_GROUP");
}
public void sendJobInfo(TaServer taServer, JobInfoVO jobInfoVO, short sendType){ try{ logger.info("--------> send job info, ta:{}, job id:{}, send type:{}", taServer.getName(), jobInfoVO.getJob().getId(), sendType);
JSONObject msgObj = new JSONObject();
msgObj.put("jobInfo", jobInfoVO);
msgObj.put("sendType", sendType);
String msgObjJson = JSONObject.toJSONString(msgObj);
Message msg = new Message("REQUEST_TOPIC" /* Topic */,
taServer.getFqdn()/*Tag*/,
new StringBuilder("job-req-").append(jobInfoVO.getJob().getId()).append("-").append(sendType).toString(), /*key e.g. job-req-1000-2*/
msgObjJson.getBytes(RemotingHelper.DEFAULT_CHARSET) /* Message body */
);
producer.send(msg, new SendCallback() {
@Override
public void onSuccess(SendResult sendResult) {
logger.info("-------->send job info success:{}", sendResult);
}
@Override
public void onException(Throwable throwable) {
logger.info("-------->send job info error:{}", throwable.getMessage());
}
});
} catch (Exception e) {
logger.error("========> send job info failed, errMsg:{}", e.getMessage(), e);
}
}
[producer log] 2020-04-03 05:14:20,529 [scheduler-7] INFO --------> send job info, ta:xxxxxx, job id:267374, send type:2 2020-04-03 05:14:20,620 [scheduler-7] INFO - --------> send job info, ta:xxxxxx, job id:267375, send type:2
[broker log] 2020-04-03 05:14:06 INFO brokerOutApi_thread_3 - register broker[0]to name server xxxxxx:9876 OK 2020-04-03 05:14:12 INFO brokerOutApi_thread_1 - register broker[1]to name server xxxxxx:9876 OK 2020-04-03 05:14:15 INFO BrokerControllerScheduledThread1 - Update slave consumer offset from master, xxxxxx:10911 2020-04-03 05:14:15 INFO BrokerControllerScheduledThread1 - Update slave delay offset from master, xxxxxx:10911 2020-04-03 05:14:25 INFO BrokerControllerScheduledThread1 - Update slave consumer offset from master, xxxxxx:10911 2020-04-03 05:14:25 INFO BrokerControllerScheduledThread1 - Update slave delay offset from master, xxxxxx:10911 2020-04-03 05:14:35 INFO BrokerControllerScheduledThread1 - Update slave consumer offset from master, xxxxxx:10911 2020-04-03 05:14:35 INFO BrokerControllerScheduledThread1 - Update slave delay offset from master, xxxxxx:10911 2020-04-03 05:14:36 INFO BrokerControllerScheduledThread1 - dispatch behind commit log 0 bytes 2020-04-03 05:14:36 INFO BrokerControllerScheduledThread1 - Slave fall behind master: 0 bytes 2020-04-03 05:14:36 INFO brokerOutApi_thread_4 - register broker[0]to name server xxxxxx:9876 OK 2020-04-03 05:14:42 INFO BrokerControllerScheduledThread1 - dispatch behind commit log 0 bytes 2020-04-03 05:14:42 INFO brokerOutApi_thread_2 - register broker[1]to name server xxxxxx:9876 OK
当时是生产者客户端日志和经纪人日志,然后没有响应,包括成功或失败, 我在经纪人那里也找不到这条消息。 客户端发送了大约100多条消息,但只丢失了这两条。 这个JVM包括多个具有相同instanceName的生产者,它有问题吗?
原提问者GitHub用户lionhuo
producer.setNamespace(namesrvAddr); 这个参数配置错了,你想配置的可能是 nameserver 地址
原回答者GitHub用户rushsky518
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
阿里云拥有国内全面的云原生产品技术以及大规模的云原生应用实践,通过全面容器化、核心技术互联网化、应用 Serverless 化三大范式,助力制造业企业高效上云,实现系统稳定、应用敏捷智能。拥抱云原生,让创新无处不在。