소스 검색

更新报警

lgy 3 년 전
부모
커밋
4800283a2a

+ 7 - 1
src/main/java/com/persagy/client/GroupNettyClient.java

@@ -141,7 +141,13 @@ public class GroupNettyClient {
     public void sendMessage(String msg) throws InterruptedException {
         log.info("给云端发送数据:[{}]", msg);
         if (channelGroup.isWritable()) {
-            channelGroup.writeAndFlush(msg);
+            try {
+                channelGroup.writeAndFlush(msg);
+            } catch (Exception e) {
+                log.error("发送数据异常,放入缓冲队列中",e);
+                NettyMessageQueue.getNettyMessageQueue().produce(msg);
+                channelGroup.close();
+            }
         } else {
             log.warn("云端netty不可写,放入缓冲队列中[{}]", msg);
             NettyMessageQueue.getNettyMessageQueue().produce(msg);

+ 2 - 2
src/main/java/com/persagy/client/WebSocketClientFactory.java

@@ -13,6 +13,7 @@ import org.java_websocket.client.WebSocketClient;
 import org.java_websocket.handshake.ServerHandshake;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import java.net.URI;
@@ -222,9 +223,8 @@ public class WebSocketClientFactory {
      * @since: 2020/10/20 9:54
      * @version: V1.0
      */
-//    @Scheduled(initialDelay = 20000, fixedDelay = 10000)
+    @Scheduled(initialDelay = 20000, fixedDelay = 60000)
     public void holderConneted() {
-        log.debug("连接状态监测中....");
         try {
             WebSocketClient outCallWebSocketClientHolder = this.getOutCallWebSocketClientHolder();
             if (null == outCallWebSocketClientHolder) {

+ 2 - 2
src/main/resources/application-39Pj5001120003.yml

@@ -12,9 +12,9 @@ terminal: #边缘端IOT采集程序地址
     #需要更改
     compress: false    #采用的是压缩方式还是不压缩方式  true-压缩 false-不压缩
     #需要更改
-    host: 172.17.233.176
+    host: 39.102.43.179
     #需要更改
-    port: 9984 #9989
+    port: 9994 #9989
     #需要更改
     suffix: websocket   #websocker后缀
 project:

+ 1 - 1
src/main/resources/application-Pj4403070003.yml

@@ -3,7 +3,7 @@ group:
   code: WD   #标识哪个接团 比如万达使用WD
   alarm:
     #需要更改
-    host: 127.0.0.1 #netty IP   39.102.43.179
+    host: 39.102.43.179 #netty IP   39.102.43.179
     #需要更改
     port: 9986          #netty 端口8826
     #需要更改

+ 2 - 2
src/main/resources/application.yml

@@ -6,10 +6,10 @@ spring:
   application:
     name: zkt-project-alarm
   profiles:
-    active: Pj4403070003
+    active: 39Pj5001120003 #Pj4403070003
   datasource:
     #需要更改
-    url: jdbc:mysql://39.102.43.179:9934/alarm-quartz-wd?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false
+    url: jdbc:mysql://39.102.43.179:9934/alarm-quartz-xg?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true&failOverReadOnly=false
     driver-class-name: com.mysql.jdbc.Driver  # mysql8.0以前使用com.mysql.jdbc.Driver
     #需要更改
     username: root