From d3500d195baae7a353d2d1d0fc724826bfea45ea Mon Sep 17 00:00:00 2001
From: caixiang <939387484@qq.com>
Date: Mon, 4 Jul 2022 14:49:49 +0800
Subject: [PATCH] mark for influx
---
pom.xml | 22 +--
.../influx/controller/S7DemoController.java | 103 ++++++----
.../health/InfluxDB2HealthIndicator.java | 55 ------
...uxDB2HealthIndicatorAutoConfiguration.java | 58 ------
.../AbstractInfluxDB2AutoConfiguration.java | 71 -------
.../influx/InfluxDB2AutoConfiguration.java | 60 ------
.../InfluxDB2OkHttpClientBuilderProvider.java | 37 ----
.../influx/influx/InfluxDB2Properties.java | 178 ------------------
.../src/main/resources/application-influx.yml | 17 --
9 files changed, 80 insertions(+), 521 deletions(-)
delete mode 100644 ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicator.java
delete mode 100644 ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicatorAutoConfiguration.java
delete mode 100644 ym-influx/src/main/java/com/cnbm/influx/influx/AbstractInfluxDB2AutoConfiguration.java
delete mode 100644 ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2AutoConfiguration.java
delete mode 100644 ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2OkHttpClientBuilderProvider.java
delete mode 100644 ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2Properties.java
delete mode 100644 ym-influx/src/main/resources/application-influx.yml
diff --git a/pom.xml b/pom.xml
index d7b8a9f..c672916 100644
--- a/pom.xml
+++ b/pom.xml
@@ -92,17 +92,17 @@
-
- org.springframework.boot
- spring-boot-actuator-autoconfigure
- true
-
-
- com.fasterxml.jackson.core
- jackson-databind
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java b/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java
index 966d208..d9927b5 100644
--- a/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java
+++ b/ym-influx/src/main/java/com/cnbm/influx/controller/S7DemoController.java
@@ -1,10 +1,17 @@
package com.cnbm.influx.controller;
+import com.cnbm.influx.common.Utils;
import com.cnbm.influx.config.InfluxClient;
+import com.cnbm.influx.param.PageInfo;
+import com.cnbm.influx.param.QueryDataParam;
+import com.cnbm.influx.param.Range;
+import com.cnbm.influx.param.Tag;
import com.cnbm.influx.template.Event;
import com.influxdb.client.InfluxDBClient;
import com.influxdb.client.domain.WritePrecision;
import com.influxdb.client.write.Point;
+import com.influxdb.query.FluxRecord;
+import com.influxdb.query.FluxTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -12,47 +19,75 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.Instant;
+import java.util.ArrayList;
+import java.util.List;
@RestController
@RequestMapping("/influx")
public class S7DemoController {
private static final Logger logger = LoggerFactory.getLogger(S7DemoController.class);
- @Autowired
- InfluxDBClient influxDBClient;
-
-
-// try (WriteApi writeApi = influxDBClient.makeWriteApi()) {
-// Temperature temperature = new Temperature();
-// temperature.setLocation("east");
-// temperature.setValue(106.2D);
-// temperature.setTime(Instant.now());
-// writeApi.writeMeasurement(WritePrecision.NS,temperature);
-// }
-//
-// try (WriteApi writeApi = influxDBClient.makeWriteApi()) {
-// Point point = Point.measurement("temperature")
-// .addTag("location","south")
-// .addTag("owner","wxm")
-// .addField("wxm",230.8);
-// writeApi.writePoint(point);
-// }
-
@PostMapping("/insertBatch")
public void insertBatch() throws InterruptedException {
-// List list = new ArrayList<>();
-//
-// for(int i=0;i<99;i++){
-// //Thread.sleep(1000);
-// Event event = new Event();
-// event.time = Instant.now();
-// event.transationId = "asas"+i;
-// event.argName = "arg5";
-// event.argValue = new Double(i);
-// list.add(event);
-// }
-// influxService.batchInsert(list);
+ List list = new ArrayList<>();
+
+ for(int i=0;i<99;i++){
+ Thread.sleep(100);
+ Event event = new Event();
+ event.setTime(Instant.now());
+ event.setTransationId("asas"+i);
+ event.setArgName("arg7");
+ event.setArgValue(new Double(i));
+ list.add(event);
+ }
+ InfluxClient.Client.batchInsert(list,"ASProcessCompleteEventAS");
+ }
+
+ @PostMapping("/query")
+ public void query() throws InterruptedException {
+ List list = new ArrayList<>();
+
+ QueryDataParam queryDataParam = new QueryDataParam();
+ queryDataParam.setBucket("qgs-bucket");
+ queryDataParam.setMeasurement("ASProcessCompleteEventAS");
+ queryDataParam.setDropedTagName("transationId");
+ queryDataParam.setTag(new Tag("argName","arg6"));
+ queryDataParam.setRange(new Range(Utils.getBeforeDate(10).toInstant(),Instant.now()));
+ queryDataParam.setPageInfo(new PageInfo(1,10));
+ List query = InfluxClient.Client.query(queryDataParam);
+
+
+ for (FluxTable fluxTable : query) {
+ List records = fluxTable.getRecords();
+ for (FluxRecord fluxRecord : records) {
+ System.out.println("value: " + fluxRecord.getValueByKey("_value"));
+
+ }
+ }
+ System.out.println();
+ }
+
+ public static void main(String[] args) {
+ List list = new ArrayList<>();
+
+ QueryDataParam queryDataParam = new QueryDataParam();
+ queryDataParam.setBucket("qgs-bucket");
+ queryDataParam.setMeasurement("ASProcessCompleteEventAS");
+ queryDataParam.setDropedTagName("transationId");
+ queryDataParam.setTag(new Tag("argName","arg7"));
+ queryDataParam.setRange(new Range(Utils.getBeforeDate(10).toInstant(),Instant.now()));
+ queryDataParam.setPageInfo(new PageInfo(2,10));
+ List query = InfluxClient.Client.query(queryDataParam);
+
+
+ for (FluxTable fluxTable : query) {
+ List records = fluxTable.getRecords();
+ for (FluxRecord fluxRecord : records) {
+ System.out.println("value: " + fluxRecord.getValueByKey("_value"));
+
+ }
+ }
}
@@ -71,8 +106,8 @@ public class S7DemoController {
event.setTime(Instant.now());
event.setTransationId("asasd11");
event.setArgName("argName11");
- event.setArgValue(7d);
+ event.setArgValue(900001d);
Point asProcessCompleteEvent = insert(event, "ASProcessCompleteEvent");
- influxDBClient.makeWriteApi().writePoint(asProcessCompleteEvent);
+ InfluxClient.Client.insert(event,"ASProcessCompleteEvent");
}
}
diff --git a/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicator.java b/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicator.java
deleted file mode 100644
index 27a1e19..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicator.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.health;
-
-import com.influxdb.client.InfluxDBClient;
-import org.springframework.boot.actuate.health.AbstractHealthIndicator;
-import org.springframework.boot.actuate.health.Health;
-import org.springframework.util.Assert;
-
-/**
- * {@link //HealthIndicator} for InfluxDB 2.
- *
- * @author Jakub Bednar (bednar@github)
- */
-public class InfluxDB2HealthIndicator extends AbstractHealthIndicator {
-
- private final InfluxDBClient influxDBClient;
-
- public InfluxDB2HealthIndicator(final InfluxDBClient influxDBClient) {
- super("InfluxDBClient 2 health check failed");
- Assert.notNull(influxDBClient, "InfluxDBClient must not be null");
-
- this.influxDBClient = influxDBClient;
- }
-
- @Override
- protected void doHealthCheck(final Health.Builder builder) {
- boolean success = this.influxDBClient.ping();
-
- if (success) {
- builder.up();
- } else {
- builder.down();
- }
- }
-}
diff --git a/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicatorAutoConfiguration.java b/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicatorAutoConfiguration.java
deleted file mode 100644
index bd2d439..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/health/InfluxDB2HealthIndicatorAutoConfiguration.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.health;
-
-import com.cnbm.influx.influx.InfluxDB2AutoConfiguration;
-import com.influxdb.client.InfluxDBClient;
-import org.springframework.boot.actuate.autoconfigure.health.CompositeHealthContributorConfiguration;
-import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator;
-import org.springframework.boot.actuate.health.HealthContributor;
-import org.springframework.boot.autoconfigure.AutoConfigureAfter;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.Map;
-
-/**
- * {@link EnableAutoConfiguration Auto-configuration} for {@link InfluxDB2HealthIndicator}.
- *
- * @author Jakub Bednar
- */
-@Configuration(proxyBeanMethods = false)
-@ConditionalOnClass(InfluxDBClient.class)
-@ConditionalOnBean(InfluxDBClient.class)
-@ConditionalOnEnabledHealthIndicator("influx")
-@AutoConfigureAfter(InfluxDB2AutoConfiguration.class)
-public class InfluxDB2HealthIndicatorAutoConfiguration
- extends CompositeHealthContributorConfiguration {
-
- @Bean
- @ConditionalOnMissingBean(name = { "influxDB2HealthIndicator", "influxDB2HealthContributor" })
- public HealthContributor influxDbHealthContributor(final Map influxDBClients) {
- return createContributor(influxDBClients);
- }
-
-}
\ No newline at end of file
diff --git a/ym-influx/src/main/java/com/cnbm/influx/influx/AbstractInfluxDB2AutoConfiguration.java b/ym-influx/src/main/java/com/cnbm/influx/influx/AbstractInfluxDB2AutoConfiguration.java
deleted file mode 100644
index 942d394..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/influx/AbstractInfluxDB2AutoConfiguration.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.influx;
-
-import com.influxdb.client.InfluxDBClientOptions;
-import okhttp3.OkHttpClient;
-import okhttp3.Protocol;
-import org.springframework.util.StringUtils;
-
-import javax.annotation.Nonnull;
-import java.util.Collections;
-
-/**
- * @author Jakub Bednar (04/08/2021 11:41)
- */
-abstract class AbstractInfluxDB2AutoConfiguration {
- protected final InfluxDB2Properties properties;
- protected final InfluxDB2OkHttpClientBuilderProvider builderProvider;
-
- protected AbstractInfluxDB2AutoConfiguration(final InfluxDB2Properties properties,
- final InfluxDB2OkHttpClientBuilderProvider builderProvider) {
- this.properties = properties;
- this.builderProvider = builderProvider;
- }
-
- @Nonnull
- protected InfluxDBClientOptions.Builder makeBuilder() {
- OkHttpClient.Builder okHttpBuilder;
- if (builderProvider == null) {
- okHttpBuilder = new OkHttpClient.Builder()
- .protocols(Collections.singletonList(Protocol.HTTP_1_1))
- .readTimeout(properties.getReadTimeout())
- .writeTimeout(properties.getWriteTimeout())
- .connectTimeout(properties.getConnectTimeout());
- } else {
- okHttpBuilder = builderProvider.get();
- }
-
- InfluxDBClientOptions.Builder influxBuilder = InfluxDBClientOptions.builder()
- .url(properties.getUrl())
- .bucket(properties.getBucket())
- .org(properties.getOrg())
- .okHttpClient(okHttpBuilder);
-
- if (StringUtils.hasLength(properties.getToken())) {
- influxBuilder.authenticateToken(properties.getToken().toCharArray());
- } else if (StringUtils.hasLength(properties.getUsername()) && StringUtils.hasLength(properties.getPassword())) {
- influxBuilder.authenticate(properties.getUsername(), properties.getPassword().toCharArray());
- }
- return influxBuilder;
- }
-}
diff --git a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2AutoConfiguration.java b/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2AutoConfiguration.java
deleted file mode 100644
index 8635d4f..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2AutoConfiguration.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.influx;
-
-import com.influxdb.client.InfluxDBClient;
-import com.influxdb.client.InfluxDBClientFactory;
-import com.influxdb.client.InfluxDBClientOptions;
-import org.springframework.beans.factory.ObjectProvider;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * {@link EnableAutoConfiguration Auto-configuration} for InfluxDB 2.
- *
- * @author Jakub Bednar (bednar@github) (06/05/2019 13:09)
- */
-@Configuration
-@ConditionalOnClass(InfluxDBClient.class)
-@EnableConfigurationProperties(InfluxDB2Properties.class)
-public class InfluxDB2AutoConfiguration extends AbstractInfluxDB2AutoConfiguration {
-
- public InfluxDB2AutoConfiguration(final InfluxDB2Properties properties,
- final ObjectProvider builderProvider) {
- super(properties, builderProvider.getIfAvailable());
- }
-
- @Bean
- @ConditionalOnProperty("influx.url")
- @ConditionalOnMissingBean(InfluxDBClient.class)
- public InfluxDBClient influxDBClient() {
-
- InfluxDBClientOptions.Builder influxBuilder = makeBuilder();
-
- return InfluxDBClientFactory.create(influxBuilder.build()).setLogLevel(properties.getLogLevel());
- }
-}
\ No newline at end of file
diff --git a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2OkHttpClientBuilderProvider.java b/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2OkHttpClientBuilderProvider.java
deleted file mode 100644
index db6fb5a..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2OkHttpClientBuilderProvider.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.influx;
-
-import okhttp3.OkHttpClient;
-
-import java.util.function.Supplier;
-
-/**
- * Provide the {@link OkHttpClient.Builder OkHttpClient.Builder} to use to
- * customize the auto-configured {@link com.influxdb.client.InfluxDBClient} instance.
- *
- * @author Jakub Bednar (bednar@github) (06/05/2019 13:11)
- */
-@FunctionalInterface
-public interface InfluxDB2OkHttpClientBuilderProvider extends Supplier {
-
-}
\ No newline at end of file
diff --git a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2Properties.java b/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2Properties.java
deleted file mode 100644
index 9e3f6dc..0000000
--- a/ym-influx/src/main/java/com/cnbm/influx/influx/InfluxDB2Properties.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * The MIT License
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-package com.cnbm.influx.influx;
-
-import com.cnbm.influx.constant.Constant;
-import com.influxdb.LogLevel;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-
-import java.time.Duration;
-
-/**
- * Configuration properties for InfluxDB 2.
- *
- * @author Jakub Bednar (bednar@github) (06/05/2019 12:54)
- */
-@ConfigurationProperties(prefix = "influx")
-public class InfluxDB2Properties {
-
-// public InfluxDB2Properties{
-// this.bucket = Constant.bucket;
-// this.url = Constant.url;
-// this.org = Constant.org;
-// this.token = Constant.token;
-// this.username = Constant.username;
-// this.password = Constant.password;
-// }
-
- private static final int DEFAULT_TIMEOUT = 10_000;
-
- /**
- * URL to connect to InfluxDB.
- */
- private String url = Constant.url;
-
- /**
- * Username to use in the basic auth.
- */
- private String username = Constant.username;
-
- /**
- * Password to use in the basic auth.
- */
- private String password = Constant.password;
-
- /**
- * Token to use for the authorization.
- */
- private String token = Constant.token;
-
- /**
- * Default destination organization for writes and queries.
- */
- private String org = Constant.org;
-
- /**
- * Default destination bucket for writes.
- */
- private String bucket = Constant.bucket;
-
- /**
- * The log level for logging the HTTP request and HTTP response.
- */
- private LogLevel logLevel = LogLevel.NONE;
-
- /**
- * Read timeout for {@code OkHttpClient}.
- */
- private Duration readTimeout = Duration.ofMillis(DEFAULT_TIMEOUT);
-
- /**
- * Write timeout for {@code OkHttpClient}.
- */
- private Duration writeTimeout = Duration.ofMillis(DEFAULT_TIMEOUT);
-
- /**
- * Connection timeout for {@code OkHttpClient}.
- */
- private Duration connectTimeout = Duration.ofMillis(DEFAULT_TIMEOUT);
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(final String url) {
- this.url = url;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(final String username) {
- this.username = username;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(final String password) {
- this.password = password;
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(final String token) {
- this.token = token;
- }
-
- public LogLevel getLogLevel() {
- return logLevel;
- }
-
- public void setLogLevel(final LogLevel logLevel) {
- this.logLevel = logLevel;
- }
-
- public String getOrg() {
- return org;
- }
-
- public void setOrg(final String org) {
- this.org = org;
- }
-
- public String getBucket() {
- return bucket;
- }
-
- public void setBucket(final String bucket) {
- this.bucket = bucket;
- }
-
- public Duration getReadTimeout() {
- return readTimeout;
- }
-
- public void setReadTimeout(final Duration readTimeout) {
- this.readTimeout = readTimeout;
- }
-
- public Duration getWriteTimeout() {
- return writeTimeout;
- }
-
- public void setWriteTimeout(final Duration writeTimeout) {
- this.writeTimeout = writeTimeout;
- }
-
- public Duration getConnectTimeout() {
- return connectTimeout;
- }
-
- public void setConnectTimeout(final Duration connectTimeout) {
- this.connectTimeout = connectTimeout;
- }
-}
\ No newline at end of file
diff --git a/ym-influx/src/main/resources/application-influx.yml b/ym-influx/src/main/resources/application-influx.yml
deleted file mode 100644
index 3c0f8bf..0000000
--- a/ym-influx/src/main/resources/application-influx.yml
+++ /dev/null
@@ -1,17 +0,0 @@
-influx:
- url: http://192.168.0.170:8086 # URL to connect to InfluxDB.
- username: caixiang # Username to use in the basic auth.
- password: 251128856 # Password to use in the basic auth.
- token: lkBsC27QZr1W50BSPlGxpTqNNpwuUk5uz1dZZRPSPbCG5VmNDDUo8P3UkZIhGWwfJwkuz6ZGZ7Et4_KBaG3gHw== # Token to use for the authorization.
- org: qgs # Default destination organization for writes and queries.
- bucket: qgs-bucket # Default destination bucket for writes.
- logLevel: BODY # The log level for logging the HTTP request and HTTP response. (Default: NONE)
- readTimeout: 5s # Read timeout for OkHttpClient. (Default: 10s)
- writeTimeout: 5s # Write timeout for OkHttpClient. (Default: 10s)
- connectTimeout: 5s # Connection timeout for OkHttpClient. (Default: 10s)
-
- # management.health.influx.enabled=true # Whether to enable InfluxDB 2.x health check.
-management:
- health:
- influxdb:
- enabled: true
\ No newline at end of file