diff --git a/collector-scheduling-management/src/main/java/com/docus/server/common/netty/server/TerminalToChannelCacheMap.java b/collector-scheduling-management/src/main/java/com/docus/server/common/netty/server/TerminalToChannelCacheMap.java index 039bd13..c60b522 100644 --- a/collector-scheduling-management/src/main/java/com/docus/server/common/netty/server/TerminalToChannelCacheMap.java +++ b/collector-scheduling-management/src/main/java/com/docus/server/common/netty/server/TerminalToChannelCacheMap.java @@ -99,6 +99,7 @@ public class TerminalToChannelCacheMap { IP_CHANNEL_CACHE_MAP.remove(key); IP_TERMINATOR_CACHE_MAP.remove(key); NettyTerminatorDTO nettyTerminatorDTO = new NettyTerminatorDTO(); + nettyTerminatorDTO.setBusyState(BusyStateEnum.IDLE); nettyTerminatorDTO.setOnlineState(OnlineStateEnum.OFFLINE); iSchTerminatorService.saveOrUpdate(key, nettyTerminatorDTO); } diff --git a/collector-terminal-management/src/main/java/com/docus/server/common/LoadPackageCommandLineRunner.java b/collector-terminal-management/src/main/java/com/docus/server/common/LoadPackageCommandLineRunner.java index 63be06e..c5436b9 100644 --- a/collector-terminal-management/src/main/java/com/docus/server/common/LoadPackageCommandLineRunner.java +++ b/collector-terminal-management/src/main/java/com/docus/server/common/LoadPackageCommandLineRunner.java @@ -136,6 +136,10 @@ public class LoadPackageCommandLineRunner implements CommandLineRunner { updatePart(loadSchCollectorVOList, value); } + loadSchCollectorVOList.forEach(p -> { + p.setDeployPath(saveCollectorPackagePath + p.getCollectorId() + "\\collector"); + }); + //根据服务器端口区分,每次更新了哪些采集器版本 template.opsForValue().set(key, JSON.toJSON(loadSchCollectorVOList)); } diff --git a/collector-terminal-management/src/main/java/com/docus/server/common/netty/ChannelAttribute.java b/collector-terminal-management/src/main/java/com/docus/server/common/netty/ChannelAttribute.java index 5d3f659..f06e8d0 100644 --- a/collector-terminal-management/src/main/java/com/docus/server/common/netty/ChannelAttribute.java +++ b/collector-terminal-management/src/main/java/com/docus/server/common/netty/ChannelAttribute.java @@ -4,7 +4,7 @@ import io.netty.channel.ChannelHandlerContext; import io.netty.util.Attribute; import io.netty.util.AttributeKey; -public class ChannelAttribute { +public class ChannelAttribute { /** * 属性键名称 diff --git a/collector-terminal-management/src/main/java/com/docus/server/common/netty/client/NettyClient.java b/collector-terminal-management/src/main/java/com/docus/server/common/netty/client/NettyClient.java index 43c9ab7..250d23d 100644 --- a/collector-terminal-management/src/main/java/com/docus/server/common/netty/client/NettyClient.java +++ b/collector-terminal-management/src/main/java/com/docus/server/common/netty/client/NettyClient.java @@ -2,6 +2,7 @@ package com.docus.server.common.netty.client; import com.docus.core.util.json.JSON; import com.docus.server.common.CommMsg; +import com.docus.server.common.netty.event.StartUpEvent; import com.docus.server.common.netty.server.CollectorChannelCacheMap; import io.netty.bootstrap.Bootstrap; import io.netty.channel.ChannelFuture; @@ -13,6 +14,7 @@ import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioSocketChannel; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.ApplicationContext; import org.springframework.core.env.Environment; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Component; @@ -46,6 +48,8 @@ public class NettyClient { private StringRedisTemplate template; @Resource private Environment env; + @Resource + private ApplicationContext applicationContext; /** * 发送消息给服务端 @@ -59,6 +63,15 @@ public class NettyClient { } } + /** + * 发送消息给服务端 + * + * @param message 消息内容 + */ + public void publishEvent(String message, CommMsg commMsg) { + applicationContext.publishEvent(new StartUpEvent(this, message, commMsg)); + } + @PostConstruct public void start() { final EventLoopGroup group = new NioEventLoopGroup(); diff --git a/collector-terminal-management/src/main/java/com/docus/server/common/netty/client/handler/ClientHandler.java b/collector-terminal-management/src/main/java/com/docus/server/common/netty/client/handler/ClientHandler.java index e66a66a..1093a21 100644 --- a/collector-terminal-management/src/main/java/com/docus/server/common/netty/client/handler/ClientHandler.java +++ b/collector-terminal-management/src/main/java/com/docus/server/common/netty/client/handler/ClientHandler.java @@ -138,16 +138,7 @@ public class ClientHandler extends SimpleChannelInboundHandler