fix:runMode修改

master
xiwa 2024-01-12 07:52:15 +08:00
parent 94b39b4f6d
commit 770a25907e
14 changed files with 39 additions and 38 deletions

View File

@ -57,7 +57,7 @@
<plugin>
<groupId>com.gitee.starblues</groupId>
<artifactId>spring-brick-maven-packager</artifactId>
<version>${spring-brick-package.version}</version>
<version>${spring-brick.version}</version>
<configuration>
<mode>${plugin.build.mode}</mode>
<pluginInfo>

View File

@ -52,7 +52,7 @@
<plugin>
<groupId>com.gitee.starblues</groupId>
<artifactId>spring-brick-maven-packager</artifactId>
<version>${spring-brick-package.version}</version>
<version>${spring-brick.version}</version>
<configuration>
<mode>${plugin.build.mode}</mode>
<pluginInfo>
@ -64,7 +64,7 @@
<configFileName>application.yml</configFileName>
</pluginInfo>
<prodConfig>
<packageType>jar</packageType>
<packageType>zip</packageType>
</prodConfig>
</configuration>
<executions>

View File

@ -1,5 +1,5 @@
plugin:
runMode: dev
runMode: prod
mainPackage: cc.iotkit.plugin
http:

View File

@ -35,7 +35,7 @@
<plugin>
<groupId>com.gitee.starblues</groupId>
<artifactId>spring-brick-maven-packager</artifactId>
<version>${spring-brick-package.version}</version>
<version>${spring-brick.version}</version>
<configuration>
<mode>${plugin.build.mode}</mode>
<pluginInfo>

View File

@ -3,6 +3,6 @@ plugin:
mainPackage: cc.iotkit.plugin
hydrovalve:
host: 25on621889.goho.co
host: xxxx
port: 38807
interval: 20000

View File

@ -45,7 +45,7 @@
<plugin>
<groupId>com.gitee.starblues</groupId>
<artifactId>spring-brick-maven-packager</artifactId>
<version>${spring-brick-package.version}</version>
<version>${spring-brick.version}</version>
<configuration>
<mode>${plugin.build.mode}</mode>
<pluginInfo>

View File

@ -1,5 +1,5 @@
plugin:
runMode: dev
runMode: prod
mainPackage: cc.iotkit.plugin

View File

@ -56,7 +56,7 @@
<plugin>
<groupId>com.gitee.starblues</groupId>
<artifactId>spring-brick-maven-packager</artifactId>
<version>${spring-brick-package.version}</version>
<version>${spring-brick.version}</version>
<configuration>
<mode>${plugin.build.mode}</mode>
<pluginInfo>

View File

@ -1,5 +1,5 @@
plugin:
runMode: dev
runMode: prod
mainPackage: cc.iotkit.plugin
mqtt:

10
pom.xml
View File

@ -10,6 +10,7 @@
<module>tcp-plugin</module>
<module>DLT645-plugin</module>
<module>hydrovalve-plugin</module>
<!-- <module>emqx-plugin</module>-->
</modules>
<parent>
@ -27,8 +28,7 @@
<properties>
<java.version>11</java.version>
<spring-boot.version>2.7.11</spring-boot.version>
<spring-brick.version>3.1.2</spring-brick.version>
<spring-brick-package.version>3.1.3</spring-brick-package.version>
<spring-brick.version>3.1.3</spring-brick.version>
<vertx.version>4.2.2</vertx.version>
</properties>
@ -86,12 +86,6 @@
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.gitee.starblues</groupId>
<artifactId>spring-brick-maven-packager</artifactId>
<version>${spring-brick-package.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -58,7 +58,7 @@
<plugin>
<groupId>com.gitee.starblues</groupId>
<artifactId>spring-brick-maven-packager</artifactId>
<version>${spring-brick-package.version}</version>
<version>${spring-brick.version}</version>
<configuration>
<mode>${plugin.build.mode}</mode>
<pluginInfo>

View File

@ -70,19 +70,23 @@ public class TcpPlugin implements PluginCloseListener, IPlugin {
@Override
public void close(GenericApplicationContext applicationContext, PluginInfo pluginInfo, PluginCloseType closeType) {
log.info("plugin close,type:{},pluginId:{}", closeType, pluginInfo.getPluginId());
if (deployedId != null) {
CountDownLatch wait = new CountDownLatch(1);
Future<Void> future = vertx.undeploy(deployedId);
future.onSuccess(unused -> {
log.info("tcp plugin stopped success");
wait.countDown();
});
future.onFailure(h -> {
log.info("tcp plugin stopped failed");
h.printStackTrace();
wait.countDown();
});
wait.await(5, TimeUnit.SECONDS);
try {
if (deployedId != null) {
CountDownLatch wait = new CountDownLatch(1);
Future<Void> future = vertx.undeploy(deployedId);
future.onSuccess(unused -> {
log.info("tcp plugin stopped success");
wait.countDown();
});
future.onFailure(h -> {
log.info("tcp plugin stopped failed");
h.printStackTrace();
wait.countDown();
});
wait.await(5, TimeUnit.SECONDS);
}
} catch (Throwable e) {
log.error("close plugin error", e);
}
}

View File

@ -37,6 +37,7 @@ import javax.annotation.PostConstruct;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/**
@ -76,13 +77,14 @@ public class TcpServerVerticle extends AbstractVerticle {
@AutowiredType(AutowiredType.Type.MAIN_PLUGIN)
private IThingService thingService;
@Override
public void start() {
initTcpServer();
}
@Override
public void stop() {
if (netServer != null) {
netServer.close(rst -> {
log.info("tcp server close:{}", rst.succeeded());
});
}
log.info("tcp server stopped");
}
@ -97,6 +99,7 @@ public class TcpServerVerticle extends AbstractVerticle {
if (scriptEngine == null) {
throw new BizException("script engine is null");
}
Executors.newSingleThreadScheduledExecutor().schedule(this::initTcpServer, 3, TimeUnit.SECONDS);
}

View File

@ -1,5 +1,5 @@
plugin:
runMode: dev
runMode: prod
mainPackage: cc.iotkit.plugin
tcp: