From 3e30b7adcb7794ed97ba8c744394b233d16f29bd Mon Sep 17 00:00:00 2001 From: tomsun28 Date: Fri, 25 Aug 2023 14:36:51 +0800 Subject: [PATCH] bugfix fix found 2 dataQueue bean when not config common.queue param (#1205) --- collector/pom.xml | 9 --------- .../collector/dispatch/export/NettyDataQueue.java | 2 +- .../queue/impl/InMemoryCommonDataQueue.java | 2 ++ script/application.yml | 5 +++++ .../hertzbeat-mysql-iotdb/conf/application.yml | 15 +++++++++++++++ .../hertzbeat-mysql-iotdb/docker-compose-1.0.yaml | 1 + .../hertzbeat-mysql-iotdb/docker-compose.yaml | 1 + .../hertzbeat-mysql-tdengine/conf/application.yml | 15 +++++++++++++++ .../hertzbeat-mysql-tdengine/docker-compose.yaml | 1 + .../conf/application.yml | 15 +++++++++++++++ .../docker-compose.yaml | 1 + 11 files changed, 57 insertions(+), 10 deletions(-) diff --git a/collector/pom.xml b/collector/pom.xml index cfaa0e6898a..85f05f89e4a 100644 --- a/collector/pom.xml +++ b/collector/pom.xml @@ -177,15 +177,6 @@ hertzbeat-collector - - - src/main/resources - true - - META-INF/** - - - org.apache.maven.plugins diff --git a/collector/src/main/java/org/dromara/hertzbeat/collector/dispatch/export/NettyDataQueue.java b/collector/src/main/java/org/dromara/hertzbeat/collector/dispatch/export/NettyDataQueue.java index e71fa3353d1..23c49284e25 100644 --- a/collector/src/main/java/org/dromara/hertzbeat/collector/dispatch/export/NettyDataQueue.java +++ b/collector/src/main/java/org/dromara/hertzbeat/collector/dispatch/export/NettyDataQueue.java @@ -37,7 +37,7 @@ * */ @Configuration -@ConditionalOnProperty(prefix = "common.queue", name = "type", havingValue = "netty", matchIfMissing = true) +@ConditionalOnProperty(prefix = "common.queue", name = "type", havingValue = "netty") @Slf4j public class NettyDataQueue implements CommonDataQueue { diff --git a/common/src/main/java/org/dromara/hertzbeat/common/queue/impl/InMemoryCommonDataQueue.java b/common/src/main/java/org/dromara/hertzbeat/common/queue/impl/InMemoryCommonDataQueue.java index cd987599a84..2f9fa22cf49 100644 --- a/common/src/main/java/org/dromara/hertzbeat/common/queue/impl/InMemoryCommonDataQueue.java +++ b/common/src/main/java/org/dromara/hertzbeat/common/queue/impl/InMemoryCommonDataQueue.java @@ -24,6 +24,7 @@ import org.springframework.beans.factory.DisposableBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; import java.util.HashMap; import java.util.Map; @@ -38,6 +39,7 @@ @Configuration @ConditionalOnProperty(prefix = "common.queue", name = "type", havingValue = "memory", matchIfMissing = true) @Slf4j +@Primary public class InMemoryCommonDataQueue implements CommonDataQueue, DisposableBean { private final LinkedBlockingQueue alertDataQueue; diff --git a/script/application.yml b/script/application.yml index b0f87d7e6e9..a8cf38a033c 100644 --- a/script/application.yml +++ b/script/application.yml @@ -158,3 +158,8 @@ common: servers: 127.0.0.1:9092 metrics-data-topic: async-metrics-data alerts-data-topic: async-alerts-data + +scheduler: + server: + enabled: true + port: 1158 diff --git a/script/docker-compose/hertzbeat-mysql-iotdb/conf/application.yml b/script/docker-compose/hertzbeat-mysql-iotdb/conf/application.yml index 8eed606be3f..a209465ed1f 100644 --- a/script/docker-compose/hertzbeat-mysql-iotdb/conf/application.yml +++ b/script/docker-compose/hertzbeat-mysql-iotdb/conf/application.yml @@ -126,3 +126,18 @@ warehouse: host: 127.0.0.1 port: 6379 password: 123456 + +common: + queue: + # memory or kafka + type: memory + # properties when queue type is kafka + kafka: + servers: 127.0.0.1:9092 + metrics-data-topic: async-metrics-data + alerts-data-topic: async-alerts-data + +scheduler: + server: + enabled: true + port: 1158 diff --git a/script/docker-compose/hertzbeat-mysql-iotdb/docker-compose-1.0.yaml b/script/docker-compose/hertzbeat-mysql-iotdb/docker-compose-1.0.yaml index fd8d355ae7d..28ce9c04f4f 100644 --- a/script/docker-compose/hertzbeat-mysql-iotdb/docker-compose-1.0.yaml +++ b/script/docker-compose/hertzbeat-mysql-iotdb/docker-compose-1.0.yaml @@ -59,6 +59,7 @@ services: - ./conf/sureness.yml:/opt/hertzbeat/config/sureness.yml ports: - "1157:1157" + - "1158:1158" networks: - hertzbeat diff --git a/script/docker-compose/hertzbeat-mysql-iotdb/docker-compose.yaml b/script/docker-compose/hertzbeat-mysql-iotdb/docker-compose.yaml index 0ce3f18266a..e926d93ac88 100644 --- a/script/docker-compose/hertzbeat-mysql-iotdb/docker-compose.yaml +++ b/script/docker-compose/hertzbeat-mysql-iotdb/docker-compose.yaml @@ -67,5 +67,6 @@ services: - ./conf/sureness.yml:/opt/hertzbeat/config/sureness.yml ports: - "1157:1157" + - "1158:1158" networks: - hertzbeat diff --git a/script/docker-compose/hertzbeat-mysql-tdengine/conf/application.yml b/script/docker-compose/hertzbeat-mysql-tdengine/conf/application.yml index 9f678063dd2..6c57ec3dd11 100644 --- a/script/docker-compose/hertzbeat-mysql-tdengine/conf/application.yml +++ b/script/docker-compose/hertzbeat-mysql-tdengine/conf/application.yml @@ -119,3 +119,18 @@ warehouse: host: 127.0.0.1 port: 6379 password: 123456 + +common: + queue: + # memory or kafka + type: memory + # properties when queue type is kafka + kafka: + servers: 127.0.0.1:9092 + metrics-data-topic: async-metrics-data + alerts-data-topic: async-alerts-data + +scheduler: + server: + enabled: true + port: 1158 diff --git a/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml b/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml index 43ac33a59a8..95bfc9076af 100644 --- a/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml +++ b/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml @@ -67,5 +67,6 @@ services: - ./conf/sureness.yml:/opt/hertzbeat/config/sureness.yml ports: - "1157:1157" + - "1158:1158" networks: - hertzbeat diff --git a/script/docker-compose/hertzbeat-postgresql-iotdb/conf/application.yml b/script/docker-compose/hertzbeat-postgresql-iotdb/conf/application.yml index 80ab8c00d9f..a6ae7e8a1d3 100644 --- a/script/docker-compose/hertzbeat-postgresql-iotdb/conf/application.yml +++ b/script/docker-compose/hertzbeat-postgresql-iotdb/conf/application.yml @@ -130,3 +130,18 @@ warehouse: host: 127.0.0.1 port: 6379 password: 123456 + +common: + queue: + # memory or kafka + type: memory + # properties when queue type is kafka + kafka: + servers: 127.0.0.1:9092 + metrics-data-topic: async-metrics-data + alerts-data-topic: async-alerts-data + +scheduler: + server: + enabled: true + port: 1158 diff --git a/script/docker-compose/hertzbeat-postgresql-iotdb/docker-compose.yaml b/script/docker-compose/hertzbeat-postgresql-iotdb/docker-compose.yaml index a9c40a19769..6e037752770 100644 --- a/script/docker-compose/hertzbeat-postgresql-iotdb/docker-compose.yaml +++ b/script/docker-compose/hertzbeat-postgresql-iotdb/docker-compose.yaml @@ -67,5 +67,6 @@ services: - ./conf/sureness.yml:/opt/hertzbeat/config/sureness.yml ports: - "1157:1157" + - "1158:1158" networks: - hertzbeat