提交 e4635431 编写于 作者: zc's avatar zc

update:代码完善

上级 b33ee060
......@@ -104,11 +104,11 @@ public class DefaultMQProducerService implements MsgProducerService{
@Override
public void sendSqlResultsMsg(SqlResultsMQMsg resultsMQMsg) throws Exception {
String msg = JSON.toJSONString(resultsMQMsg);
log.trace(String.format("sendResultsMsg:%1$s", msg));
log.trace(String.format("sendSqlResultsMsg:%1$s", msg));
dstRocketMQTemplate.asyncSendOrderly(resultsTopic+":SqlResult",msg, DigestUtils.md5DigestAsHex(msg.getBytes()),new SendCallback(){
@Override
public void onSuccess(SendResult sendResult) {
log.info("结果消息发送响应:" + sendResult.toString());
log.info("SqlResultsMsg结果消息发送响应:" + sendResult.toString());
}
@Override
......
......@@ -40,9 +40,6 @@ public class ResultMQMsgListener implements RocketMQListener<MessageExt> {
@Lazy
private ExecResultRepository execResultRepository;
@Value("${rocketmq.producer.resultsTopic:DSTRESULTSMSG}")
private String resultsTopic;
@Value("${defaultResultDataSource:default}")
private String Default_ResultDataSource;
......@@ -74,7 +71,6 @@ public class ResultMQMsgListener implements RocketMQListener<MessageExt> {
String tags = messageExt.getTags();
String topic = messageExt.getTopic();
log.info("MQ消息topic={}, tags={}, 消息内容={}", topic, tags, messageExt.getMsgId());
if (resultsTopic.equalsIgnoreCase(topic)) {
if (StringUtils.isEmpty(cassandraHost)) {
SqlResultsMQMsg resultsMQMsg = JSON.parseObject(body, new TypeReference<SqlResultsMQMsg>() {
});
......@@ -103,14 +99,14 @@ public class ResultMQMsgListener implements RocketMQListener<MessageExt> {
execlog.setRetCode(10);
ruExecLogService.updateById(execlog);
} else {
ResultsMQMsg resultsMQMsg = JSON.parseObject(body, new TypeReference<ResultsMQMsg>() {});
if(!StringUtils.isEmpty(resultsMQMsg.getKeyValueField())){
ResultsMQMsg resultsMQMsg = JSON.parseObject(body, new TypeReference<ResultsMQMsg>() {
});
if (!StringUtils.isEmpty(resultsMQMsg.getKeyValueField())) {
execResultRepository.saveResultsMQMsg(resultsMQMsg);
}
}
}
} catch (Exception e) {
log.error("获取MQ消息内容异常{}",e);
log.error("获取MQ消息内容异常{}", e);
}
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册