提交 fa7c8c9d authored 作者: 刘海泉's avatar 刘海泉

增加mq消息的catch 处理

上级 d8f7a1bf
...@@ -7,6 +7,7 @@ import com.clx.performance.constant.RabbitKeyConstants; ...@@ -7,6 +7,7 @@ import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.dao.OrderGoodsDriverTruckDao; import com.clx.performance.dao.OrderGoodsDriverTruckDao;
import com.clx.performance.model.OrderGoodsDriverTruck; import com.clx.performance.model.OrderGoodsDriverTruck;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.springframework.amqp.core.Message; import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener; import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -24,6 +25,7 @@ public class OrderGoodsDriverTruckListener { ...@@ -24,6 +25,7 @@ public class OrderGoodsDriverTruckListener {
@RabbitListener(queues = RabbitKeyConstants.ORDER_GOODS_SYNC_TRUCK_DRIVER_INFO_QUEUE) @RabbitListener(queues = RabbitKeyConstants.ORDER_GOODS_SYNC_TRUCK_DRIVER_INFO_QUEUE)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void onMessage(Message message) throws Exception { public void onMessage(Message message) throws Exception {
try{
log.info("处理货单定向司机表,数据为{}", message); log.info("处理货单定向司机表,数据为{}", message);
JSONArray jsonArray = JSONUtil.parseArray(new String(message.getBody())); JSONArray jsonArray = JSONUtil.parseArray(new String(message.getBody()));
if (jsonArray.isEmpty()) { if (jsonArray.isEmpty()) {
...@@ -65,6 +67,11 @@ public class OrderGoodsDriverTruckListener { ...@@ -65,6 +67,11 @@ public class OrderGoodsDriverTruckListener {
break; break;
} }
} }
}catch(Exception e){
log.error("处理货单定向司机表发生异常,,数据为{},异常原因:{}", message, ExceptionUtils.getStackTrace(e));
}
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论