From d6b7d8eabcdd2f92d4031fed98bd69e3f68e22ea Mon Sep 17 00:00:00 2001 From: caixiang <939387484@qq.com> Date: Thu, 17 Nov 2022 09:42:31 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E6=88=90=E6=96=B0=E7=89=88SECS/GEM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../qgs/dc/mq/consumer/PID10_1Received.java | 21 ++++++++++++++++--- .../java/com/qgs/dc/mq/entity/MQMessage.java | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) 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;