fix:http插件上报增加时间、停止插件修改

master
xiwa 2024-02-20 21:16:05 +08:00
parent 9cfe8ddb09
commit bd47b3f1c3
1 changed files with 7 additions and 1 deletions

View File

@ -64,7 +64,8 @@ public class HttpVerticle extends AbstractVerticle implements Handler<RoutingCon
public void start() { public void start() {
Executors.newSingleThreadScheduledExecutor().schedule(this::initHttpServer, 3, TimeUnit.SECONDS); Executors.newSingleThreadScheduledExecutor().schedule(this::initHttpServer, 3, TimeUnit.SECONDS);
} }
private void initHttpServer(){
private void initHttpServer() {
httpServer = vertx.createHttpServer(); httpServer = vertx.createHttpServer();
Router router = Router.router(vertx); Router router = Router.router(vertx);
router.route().handler(BodyHandler.create()).handler(this); router.route().handler(BodyHandler.create()).handler(this);
@ -79,6 +80,9 @@ public class HttpVerticle extends AbstractVerticle implements Handler<RoutingCon
@Override @Override
public void stop() { public void stop() {
httpServer.close(rst -> {
log.info("http server close:{}", rst.succeeded());
});
} }
@Override @Override
@ -153,6 +157,7 @@ public class HttpVerticle extends AbstractVerticle implements Handler<RoutingCon
.level(EventLevel.INFO) .level(EventLevel.INFO)
.name(parts[3]) .name(parts[3])
.params(payload.getJsonObject("params").getMap()) .params(payload.getJsonObject("params").getMap())
.time(System.currentTimeMillis())
.build() .build()
); );
end(response); end(response);
@ -169,6 +174,7 @@ public class HttpVerticle extends AbstractVerticle implements Handler<RoutingCon
.productKey(productKey) .productKey(productKey)
.deviceName(deviceName) .deviceName(deviceName)
.params(payload.getJsonObject("params").getMap()) .params(payload.getJsonObject("params").getMap())
.time(System.currentTimeMillis())
.build() .build()
); );
end(response); end(response);