From aad0daa1a5981cb81dbbc779c36a1a9bf0b0eb82 Mon Sep 17 00:00:00 2001 From: linwl <304115325@qq.com> Date: Wed, 24 Feb 2021 18:13:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=B0=83=E8=AF=95=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/telpo/iotgateway/server/IotSubscribe.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/telpo/iotgateway/server/IotSubscribe.java b/src/main/java/com/telpo/iotgateway/server/IotSubscribe.java index 6ef6cad..48163db 100644 --- a/src/main/java/com/telpo/iotgateway/server/IotSubscribe.java +++ b/src/main/java/com/telpo/iotgateway/server/IotSubscribe.java @@ -97,15 +97,20 @@ public class IotSubscribe { Destination queue = (Destination)context.lookup("QUEUE"); // 创建连接。 + log.debug("Befor cf.createConnection"); Connection connection = cf.createConnection(userInfo, password); + log.debug("Befor connection.addConnectionListener"); ((JmsConnection) connection).addConnectionListener(myJmsConnectionListener); // 创建会话。 // Session.CLIENT_ACKNOWLEDGE: 收到消息后,需要手动调用message.acknowledge()。 // Session.AUTO_ACKNOWLEDGE: SDK自动ACK(推荐)。 + log.debug("Befor connection.createSession"); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + log.debug("Befor connection.start"); connection.start(); // 创建Receiver连接。消费消息 + log.debug("Befor session.createConsumer"); MessageConsumer consumer = session.createConsumer(queue); // 设置消息侦听