</bnd.importpackage>
<okhttp3.version>3.14.9</okhttp3.version>
<retrofit.version>2.7.2</retrofit.version>
- <influx2.version>1.15.0</influx2.version>
+ <influx2.version>4.3.0</influx2.version>
<influx1.version>2.21</influx1.version>
</properties>
<artifactId>influxdb-client-java</artifactId>
<version>${influx2.version}</version>
</dependency>
+ <dependency>
+ <groupId>com.influxdb</groupId>
+ <artifactId>influxdb-client-utils</artifactId>
+ <version>${influx2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.squareup.retrofit2</groupId>
+ <artifactId>adapter-rxjava2</artifactId>
+ <version>${retrofit.version}</version>
+ </dependency>
<dependency>
<groupId>com.influxdb</groupId>
<artifactId>influxdb-client-core</artifactId>
import com.influxdb.client.InfluxDBClientOptions;
import com.influxdb.client.QueryApi;
import com.influxdb.client.WriteApi;
-import com.influxdb.client.domain.HealthCheck;
import com.influxdb.client.domain.Ready;
import com.influxdb.client.domain.WritePrecision;
import com.influxdb.client.write.Point;
@Override
public boolean isConnected() {
InfluxDBClient client = this.client;
- return client != null && client.health().getStatus() == HealthCheck.StatusEnum.PASS;
+ return client != null && client.ping();
}
@Override
this.client = createdClient;
queryAPI = createdClient.getQueryApi();
- writeAPI = createdClient.getWriteApi();
+ writeAPI = createdClient.makeWriteApi();
deleteAPI = createdClient.getDeleteApi();
- logger.debug("Successfully connected to InfluxDB. Instance ready={}", createdClient.ready());
+
+ logger.debug("Successfully connected to InfluxDB. Instance pingable={}", createdClient.ping());
return checkConnectionStatus();
}
public boolean checkConnectionStatus() {
final InfluxDBClient currentClient = client;
if (currentClient != null) {
+ boolean isUp = false;
Ready ready = currentClient.ready();
- boolean isUp = ready != null && ready.getStatus() == Ready.StatusEnum.READY;
+ if (ready != null) {
+ isUp = ready.getStatus() == Ready.StatusEnum.READY;
+ } else {
+ logger.debug(
+ "Failure resolving database readiness. Falling back to ping check. This is normal when using InfluxDB Cloud Serverless.");
+ isUp = currentClient.ping();
+ }
+
if (isUp) {
logger.debug("database status is OK");
} else {