Source:
public void consume(String message) { logger.info("[标的放款MQ] LoanOutSuccess_AssignCoupon receive message: {}: {}.", this.queue(), message); if (!StringUtils.isEmpty(message)) { LoanOutSuccessMessage loanOutInfo; try { loanOutInfo = JsonConverter.readValue(message, LoanOutSuccessMessage.class); } catch (IOException e) { logger.error("[标的放款MQ] LoanOutSuccess_AssignCoupon json convert LoanOutSuccessMessage is fail, message:{}", message); smsWrapperClient.sendFatalNotify(new SmsFatalNotifyDto("发送现金红包失败")); throw new RuntimeException(e); } long loanId = loanOutInfo.getLoanId(); List<String> fatalSmsList = Lists.newArrayList(); logger.info("[标的放款MQ] LoanOutSuccess_AssignCoupon is execute, loanId:{0}", loanId); if (!payWrapperClient.sendRedEnvelopeAfterLoanOut(loanId).isSuccess()) { fatalSmsList.add("发送现金红包失败"); logger.error(MessageFormat.format("[标的放款MQ] LoanOutSuccess_AssignCoupon is fail. loanId:{0}", String.valueOf(loanId))); } if (CollectionUtils.isNotEmpty(fatalSmsList)) { fatalSmsList.add(MessageFormat.format("标的ID:{0}", loanId)); smsWrapperClient.sendFatalNotify(new SmsFatalNotifyDto(Joiner.on(",").join(fatalSmsList))); logger.error(MessageFormat.format("[标的放款MQ] LoanOutSuccess_AssignCoupon is fail, sms sending. loanId:{0}, queue:{1}", String.valueOf(loanId)), MessageQueue.LoanOutSuccess_AssignCoupon); throw new RuntimeException("[标的放款MQ] LoanOutSuccess_AssignCoupon is fail. loanOutInfo: " + message); } logger.info("[标的放款MQ] LoanOutSuccess_AssignCoupon consume success."); } }

Target:
public void consume(String message) { logger.info("[标的放款MQ] LoanOutSuccess_AssignCoupon receive message: {}: {}.", this.queue(), message); if (Strings.isNullOrEmpty(message)) { logger.error("[标的放款MQ] LoanOutSuccess_AssignCoupon receive message is empty"); smsWrapperClient.sendFatalNotify(new SmsFatalNotifyDto("发送现金红包失败, MQ消息为空")); return; } LoanOutSuccessMessage loanOutInfo; try { loanOutInfo = JsonConverter.readValue(message, LoanOutSuccessMessage.class); if (loanOutInfo.getLoanId() == null) { logger.error("[标的放款MQ] LoanOutSuccess_AssignCoupon loanId is empty"); smsWrapperClient.sendFatalNotify(new SmsFatalNotifyDto("发送现金红包失败, 消息中loanId为空")); return; } } catch (IOException e) { logger.error("[标的放款MQ] LoanOutSuccess_AssignCoupon json convert LoanOutSuccessMessage is fail, message:{}", message); smsWrapperClient.sendFatalNotify(new SmsFatalNotifyDto("发送现金红包失败, 解析消息失败")); return; } long loanId = loanOutInfo.getLoanId(); logger.info("[标的放款MQ] LoanOutSuccess_AssignCoupon is executing, loanId:{0}", loanId); boolean result; try { result = payWrapperClient.sendRedEnvelopeAfterLoanOut(loanId).isSuccess(); } catch (Exception e) { logger.error("[标的放款MQ] LoanOutSuccess_AssignCoupon json convert LoanOutSuccessMessage is fail, message:{}", message); smsWrapperClient.sendFatalNotify(new SmsFatalNotifyDto("发送现金红包失败, 业务处理异常")); return; } if (!result) { smsWrapperClient.sendFatalNotify(new SmsFatalNotifyDto(MessageFormat.format("发送现金红包失败,标的ID:{0}", String.valueOf(loanId)))); logger.error(MessageFormat.format("[标的放款MQ] LoanOutSuccess_AssignCoupon is fail. loanId:{0}", String.valueOf(loanId))); throw new RuntimeException("[标的放款MQ] LoanOutSuccess_AssignCoupon is fail. loanOutInfo: " + message); } logger.info("[标的放款MQ] LoanOutSuccess_AssignCoupon consume success."); }