|
|
package com.monitor.middleware.rabbitmq.component;
|
|
|
|
|
|
import com.monitor.middleware.rabbitmq.model.PointView;
|
|
|
import com.squareup.okhttp.OkHttpClient;
|
|
|
import okhttp3.OkHttpClient;
|
|
|
import org.influxdb.InfluxDB;
|
|
|
import org.influxdb.InfluxDBFactory;
|
|
|
import org.influxdb.dto.Query;
|
...
|
...
|
@@ -10,7 +10,6 @@ import org.slf4j.Logger; |
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import retrofit.client.OkClient;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import java.util.concurrent.TimeUnit;
|
...
|
...
|
@@ -44,15 +43,12 @@ public class InfluxComp { |
|
|
@PostConstruct
|
|
|
public void init() {
|
|
|
|
|
|
OkHttpClient okHttpClient = new OkHttpClient();
|
|
|
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
|
|
builder.connectTimeout(15, TimeUnit.SECONDS);
|
|
|
builder.readTimeout(40, TimeUnit.SECONDS);
|
|
|
builder.writeTimeout(20, TimeUnit.SECONDS);
|
|
|
|
|
|
okHttpClient.setConnectTimeout(15, TimeUnit.SECONDS);
|
|
|
|
|
|
okHttpClient.setReadTimeout(40, TimeUnit.SECONDS);
|
|
|
|
|
|
okHttpClient.setWriteTimeout(20, TimeUnit.SECONDS);
|
|
|
|
|
|
influxDBClient = InfluxDBFactory.connect(this.influxUrl, this.influxUser, this.influxPwd, new OkClient(okHttpClient));
|
|
|
influxDBClient = InfluxDBFactory.connect(this.influxUrl, this.influxUser, this.influxPwd, builder);
|
|
|
}
|
|
|
|
|
|
public void doWriteView(PointView pointView, String DBName) {
|
...
|
...
|
|