diff --git a/src/main/java/com/qgs/dc/mq/consumer/PID10_1Received.java b/src/main/java/com/qgs/dc/mq/consumer/PID10_1Received.java index fa40a7b..6c19f6e 100644 --- a/src/main/java/com/qgs/dc/mq/consumer/PID10_1Received.java +++ b/src/main/java/com/qgs/dc/mq/consumer/PID10_1Received.java @@ -62,12 +62,27 @@ public class PID10_1Received{ String transactionId = mqMessage.getHeader().getTransactionId(); System.out.println("收到的消息是: "+mqMessage.toString()); System.out.println(); - logger.info(mqMessage.toString()); //todo reply reply(mqMessage); +// //回调给MES --- 开始 +// //1. 正常情况 +// String integer= HttpUtil.post(Constant.mesCallBackUrl,JSONObject.toJSONString(mqMessage)); +// Integer result = Integer.valueOf(integer); +// +// //注意 这里特别注意 已经拒收的消息 再签收是要出错的,这里要特别注意。 +// if(result == 1){ +// logger.info("在 EAP_REQUEST_QUEUE_PID4B 队列中,transitionId"+transactionId+", 这条消息处理成功"); +// channel.basicAck(deliveryTag,false); +// }else { +// logger.error("在 EAP_REQUEST_QUEUE_PID4B 队列中,transitionId"+transactionId+" 处理消息的时候 出现异常,然后 拒签消息 ,然后丢到死信队列"); +// channel.basicNack(deliveryTag,false,false); +// } +// //回调给MES --- 结束 + + + channel.basicAck(deliveryTag,false); - System.out.println(mqMessage.toString()); }catch (Exception e){ // 第一个false 是 不批量签收;第二个false 是 不重回队列 logger.error(e.getMessage()); @@ -91,7 +106,7 @@ public class PID10_1Received{ response.setReturns(aReturn); rabbitSender.sendDirect(response,ConfigOfPID10_1.EXCHANGE_NAME_PID10_1,ConfigOfPID10_1.EAP_RESPONSE_QUEUE_ROUTINGKEY_PID10_1); - System.out.println("reply: "+response.toString()); + System.out.println("回复的消息是: "+response.toString()); } diff --git a/src/main/java/com/qgs/dc/mq/entity/MQMessage.java b/src/main/java/com/qgs/dc/mq/entity/MQMessage.java index 34a0817..687fde5 100644 --- a/src/main/java/com/qgs/dc/mq/entity/MQMessage.java +++ b/src/main/java/com/qgs/dc/mq/entity/MQMessage.java @@ -20,6 +20,7 @@ public class MQMessage { private Header header; @JSONField(jsonDirect = true) private String body; + //在序列化和反序列化 的时候 都会把 json 里面的return字段转成 object 里面的returns字段 @JSONField(name = "return") private Returns returns;