本文整理了Java中org.influxdb.InfluxDB.enableGzip()
方法的一些代码示例,展示了InfluxDB.enableGzip()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InfluxDB.enableGzip()
方法的具体详情如下:
包路径:org.influxdb.InfluxDB
类名称:InfluxDB
方法名:enableGzip
[英]Enable Gzip compress for http request body.
[中]为http请求体启用Gzip压缩。
代码示例来源:origin: org.apereo.cas/cas-server-support-influxdb-core
public InfluxDbConnectionFactory(final String url, final String uid,
final String psw, final String dbName,
final boolean dropDatabase) {
if (StringUtils.isBlank(dbName) || StringUtils.isBlank(url)) {
throw new IllegalArgumentException("Database name/url cannot be blank and must be specified");
}
val builder = new OkHttpClient.Builder();
this.influxDb = InfluxDBFactory.connect(url, uid, psw, builder);
this.influxDb.enableGzip();
if (dropDatabase) {
this.influxDb.deleteDatabase(dbName);
}
if (!this.influxDb.databaseExists(dbName)) {
this.influxDb.createDatabase(dbName);
}
this.influxDb.setLogLevel(InfluxDB.LogLevel.NONE);
if (LOGGER.isDebugEnabled()) {
this.influxDb.setLogLevel(InfluxDB.LogLevel.FULL);
} else if (LOGGER.isInfoEnabled()) {
this.influxDb.setLogLevel(InfluxDB.LogLevel.BASIC);
} else if (LOGGER.isWarnEnabled()) {
this.influxDb.setLogLevel(InfluxDB.LogLevel.HEADERS);
} else if (LOGGER.isErrorEnabled()) {
this.influxDb.setLogLevel(InfluxDB.LogLevel.NONE);
}
}
代码示例来源:origin: miwurster/spring-data-influxdb
public InfluxDB getConnection()
{
Assert.notNull(getProperties(), "InfluxDBProperties are required");
if (connection == null)
{
final Builder client = new OkHttpClient.Builder()
.connectTimeout(properties.getConnectTimeout(), TimeUnit.SECONDS)
.writeTimeout(properties.getWriteTimeout(), TimeUnit.SECONDS)
.readTimeout(properties.getReadTimeout(), TimeUnit.SECONDS);
connection = InfluxDBFactory
.connect(properties.getUrl(), properties.getUsername(), properties.getPassword(), client);
logger.debug("Using InfluxDB '{}' on '{}'", properties.getDatabase(), properties.getUrl());
if (properties.isGzip())
{
logger.debug("Enabled gzip compression for HTTP requests");
connection.enableGzip();
}
}
return connection;
}
代码示例来源:origin: Scrin/RuuviCollector
private InfluxDB createInfluxDB() {
InfluxDB influxDB = InfluxDBFactory.connect(Config.getInfluxUrl(), Config.getInfluxUser(), Config.getInfluxPassword());
influxDB.setDatabase(Config.getInfluxDatabase());
influxDB.enableGzip();
influxDB.enableBatch(BATCH_SIZE, 100, TimeUnit.MILLISECONDS);
return influxDB;
}
代码示例来源:origin: Scrin/RuuviCollector
public LegacyInfluxDBConnection() {
influxDB = InfluxDBFactory.connect(Config.getInfluxUrl(), Config.getInfluxUser(), Config.getInfluxPassword());
influxDB.setDatabase(Config.getInfluxDatabase());
influxDB.enableGzip();
influxDB.enableBatch(2000, 100, TimeUnit.MILLISECONDS); // TODO: make these configurable
}
代码示例来源:origin: Scrin/RuuviCollector
influxDB = InfluxDBFactory.connect(url, user, password).setDatabase(database).setRetentionPolicy(retentionPolicy);
if (gzip) {
influxDB.enableGzip();
} else {
influxDB.disableGzip();
代码示例来源:origin: apache/bahir-flink
/**
* Initializes the connection to InfluxDB by either cluster or sentinels or single server.
*/
@Override
public void open(Configuration parameters) throws Exception {
super.open(parameters);
influxDBClient = InfluxDBFactory.connect(influxDBConfig.getUrl(), influxDBConfig.getUsername(), influxDBConfig.getPassword());
if (!influxDBClient.databaseExists(influxDBConfig.getDatabase())) {
if(influxDBConfig.isCreateDatabase()) {
influxDBClient.createDatabase(influxDBConfig.getDatabase());
}
else {
throw new RuntimeException("This " + influxDBConfig.getDatabase() + " database does not exist!");
}
}
influxDBClient.setDatabase(influxDBConfig.getDatabase());
if (influxDBConfig.getBatchActions() > 0) {
influxDBClient.enableBatch(influxDBConfig.getBatchActions(), influxDBConfig.getFlushDuration(), influxDBConfig.getFlushDurationTimeUnit());
}
if (influxDBConfig.isEnableGzip()) {
influxDBClient.enableGzip();
}
}
代码示例来源:origin: NightscoutFoundation/xDrip
InfluxDBFactory.connect(dbUri, dbUser, dbPassword, client).enableGzip().write(batchPoints);
last_error = null;
return true;
代码示例来源:origin: jamorham/xDrip-plus
InfluxDBFactory.connect(dbUri, dbUser, dbPassword, client).enableGzip().write(batchPoints);
last_error = null;
return true;
内容来源于网络,如有侵权,请联系作者删除!