Commit fc576e5a authored by data-爬虫-任锋's avatar data-爬虫-任锋

mq消息接收添加日志

parent 18e86113
...@@ -2,6 +2,7 @@ package com.quantgroup.asset.distribution.config.rabbitmq; ...@@ -2,6 +2,7 @@ package com.quantgroup.asset.distribution.config.rabbitmq;
import cn.quantgroup.tech.brave.service.ITechRabbitBuilder; import cn.quantgroup.tech.brave.service.ITechRabbitBuilder;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Stopwatch;
import com.quantgroup.asset.distribution.enums.funding.FundingResult; import com.quantgroup.asset.distribution.enums.funding.FundingResult;
import com.quantgroup.asset.distribution.service.funding.IAidFundRouteRecordService; import com.quantgroup.asset.distribution.service.funding.IAidFundRouteRecordService;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
...@@ -21,6 +22,7 @@ import org.springframework.messaging.handler.annotation.support.DefaultMessageHa ...@@ -21,6 +22,7 @@ import org.springframework.messaging.handler.annotation.support.DefaultMessageHa
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.TimeUnit;
@Slf4j @Slf4j
@Configuration @Configuration
...@@ -61,16 +63,17 @@ public class ConsumerConfig implements RabbitListenerConfigurer { ...@@ -61,16 +63,17 @@ public class ConsumerConfig implements RabbitListenerConfigurer {
public void process(Message message, Channel channel) throws IOException { public void process(Message message, Channel channel) throws IOException {
String ms = null; String ms = null;
try{ try{
Stopwatch stopwatch = Stopwatch.createStarted();
ms = new String(message.getBody(), "utf-8"); ms = new String(message.getBody(), "utf-8");
log.info("助贷资金路由结果消息接收, 消息内容 : {} ",ms);
JSONObject jo = JSONObject.parseObject(ms); JSONObject jo = JSONObject.parseObject(ms);
String noticeType = jo.getString("noticeType"); String noticeType = jo.getString("noticeType");
if(FundingResult.REJECT.getCode().equals(noticeType) if(FundingResult.REJECT.getCode().equals(noticeType)
|| FundingResult.CANCEL_LOAN.getCode().equals(noticeType) || FundingResult.CANCEL_LOAN.getCode().equals(noticeType)
|| FundingResult.FUAD_ASSIGN_SUCC.getCode().equals(noticeType)){ || FundingResult.FUAD_ASSIGN_SUCC.getCode().equals(noticeType)){
log.info("助贷资金路由有效MQ消息接收, 消息内容 : {} ",ms);
String applyNo = jo.getJSONObject("data").getString("applyNo"); String applyNo = jo.getJSONObject("data").getString("applyNo");
iAidFundRouteRecordService.fundingResultNotity(applyNo,FundingResult.getAuditResultByDesc(noticeType)); iAidFundRouteRecordService.fundingResultNotity(applyNo,FundingResult.getAuditResultByDesc(noticeType));
log.info("助贷资金路由结果消息处理完毕, bizNo : {} ,noticeType : {} ",applyNo,noticeType); log.info("助贷资金路由有效MQ消息处理结束, bizNo : {} ,noticeType : {} , 耗时 : {} ",applyNo,noticeType,stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
} }
// 采用手动应答模式, 手动确认应答更为安全稳定 // 采用手动应答模式, 手动确认应答更为安全稳定
channel.basicAck(message.getMessageProperties().getDeliveryTag(), true); channel.basicAck(message.getMessageProperties().getDeliveryTag(), true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment