diff --git a/.circleci/config.yml b/.circleci/config.yml
index 809c7c5ee77..e5b07abd280 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -109,7 +109,7 @@ jobs:
parameters:
maven-image:
type: string
- default: &default-maven-image "cimg/openjdk:8.0"
+ default: &default-maven-image "cimg/openjdk:17.0"
influxdb-image:
type: string
default: &default-influxdb-image "influxdb:latest"
@@ -250,11 +250,6 @@ workflows:
- check-dependencies
- check-generate-site
- check-licenses
- - tests-java:
- name: jdk-8
- - tests-java:
- name: jdk-11
- maven-image: "cimg/openjdk:11.0"
- tests-java:
name: jdk-17
maven-image: "cimg/openjdk:17.0"
@@ -262,7 +257,10 @@ workflows:
name: jdk-20
maven-image: "cimg/openjdk:20.0"
- tests-java:
- name: jdk-8-nightly
+ name: jdk-21
+ maven-image: "cimg/openjdk:21.0"
+ - tests-java:
+ name: jdk-17-nightly
influxdb-image: "quay.io/influxdb/influxdb:nightly"
- tests-java:
name: client-backpressure
@@ -275,11 +273,10 @@ workflows:
- check-dependencies
- check-generate-site
- check-licenses
- - jdk-8
- - jdk-11
- jdk-17
- jdk-20
- - jdk-8-nightly
+ - jdk-21
+ - jdk-17-nightly
filters:
branches:
only: master
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b9c3cb14e75..915e96e5aa1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,156 @@
+## 7.4.0 [unreleased]
+
+## 7.3.0 [2025-05-22]
+
+### Features
+
+- [#821](https://github.com/influxdata/influxdb-client-java/pull/821): Prevent duplicate interceptors in OkHttpClient builder
+
+### Dependencies
+
+⚠️ Important Notice: Starting from this release, we won’t be listing every dependency change in our changelog. This helps us maintain the project faster and focus on important features for our InfluxDB client.
+
+## 7.2.0 [2024-08-12]
+
+### Features
+
+- [#745](https://github.com/influxdata/influxdb-client-java/pull/745): New example `WriteHttpExceptionHandled.java` showing how to make use of `InfluxException.headers()` when HTTP Errors are returned from server. Also, now writes selected headers to client log.
+- [#719](https://github.com/influxdata/influxdb-client-java/issues/719): `InfluxQLQueryService` header changes.
+ - `Accept` header can now be defined when making `InfluxQLQuery` calls. Supoorted MIME types:
+ - `application/csv`
+ - `application/json`
+ - The value `application/csv` remains the default.
+ - :warning: Side effects of these changes:
+ - When using `application/json`, timestamp fields are returned in the [RFC3339](https://www.rfc-editor.org/rfc/rfc3339) format unless `InfluxQLQuery.setPrecision()` has been previously called, in which case they are returned in the POSIX epoch format.
+ - When using `application/csv`, timestamp fields are returned in the POSIX epoch format.
+ - Convenience methods have been added to `InfluxQLQueryAPI` to simplify expressly specifying JSON or CSV calls.
+ - Epoch timestamps can also be ensured by calling `InfluxQLQuery.setPrecision()` before executing a query call.
+ - An `AcceptHeader` field has also been added to the `InfluxQLQuery` class and can be set with `InfluxQLQuery.setAcceptHeader()`.
+ - More information from the server side:
+ - [Generated REST API Documentation](https://docs.influxdata.com/influxdb/v2/api/v1-compatibility/#operation/PostQueryV1)
+ - [Influx 1.1 query compatibility](https://docs.influxdata.com/influxdb/latest/reference/api/influxdb-1x/query/)
+ - See the updated InfluxQLExample
+
+### Bug Fixes
+
+1. [#744](https://github.com/influxdata/influxdb-client-java/issues/744) following an `InfluxQLQueryAPI.query()` call, empty results from the server no longer result in a `null` result value.
+
+### Dependencies
+
+Update dependencies:
+
+#### Build:
+ - [#753](https://github.com/influxdata/influxdb-client-java/pull/753): `spring-boot` to `3.3.2`
+ - [#726](https://github.com/influxdata/influxdb-client-java/pull/726): `kotlin` to `2.0.0`
+ - [#752](https://github.com/influxdata/influxdb-client-java/pull/752): `micrometer-registry-influx` to `1.13.2`
+ - [#749](https://github.com/influxdata/influxdb-client-java/pull/749): `kotlin-coroutines` to `1.8.1`
+ - [#735](https://github.com/influxdata/influxdb-client-java/pull/735): `scala-collection-compat_2.12` to `2.12.0`
+ - [#740](https://github.com/influxdata/influxdb-client-java/pull/740): `pekko` to `1.0.3`
+ - [#741](https://github.com/influxdata/influxdb-client-java/pull/741): `commons-csv` to `1.11.0`
+ - [#743](https://github.com/influxdata/influxdb-client-java/pull/743): `gson` to `2.11.0`
+
+#### Maven:
+ - [#721](https://github.com/influxdata/influxdb-client-java/pull/721): `build-helper-maven-plugin` to `3.6.0`
+ - [#728](https://github.com/influxdata/influxdb-client-java/pull/728): `maven-source-plugin` to `3.3.1`
+ - [#729](https://github.com/influxdata/influxdb-client-java/pull/729): `maven-enforcer-plugin` to `3.5.0`
+ - [#730](https://github.com/influxdata/influxdb-client-java/pull/730): `scala-maven-plugin` to `4.9.1`
+ - [#734](https://github.com/influxdata/influxdb-client-java/pull/734): `maven-compiler-plugin` to `3.13.0`
+ - [#736](https://github.com/influxdata/influxdb-client-java/pull/736): `jacoco-maven-plugin` to `0.8.12`
+ - [#748](https://github.com/influxdata/influxdb-client-java/pull/748): `maven-surefire-plugin`, `maven-failsafe-plugin` to `3.3.1`
+ - [#746](https://github.com/influxdata/influxdb-client-java/pull/746): `maven-jar-plugin` to `3.4.2`
+ - [#747](https://github.com/influxdata/influxdb-client-java/pull/747): `maven-project-info-reports-plugin` to `3.6.2`
+ - [#751](https://github.com/influxdata/influxdb-client-java/pull/751): `license-maven-plugin` to `4.5`
+
+#### Test:
+ - [#724](https://github.com/influxdata/influxdb-client-java/pull/724): `assertj` to `3.26.0`
+ - [#725](https://github.com/influxdata/influxdb-client-java/pull/725): `assertk-jvm` to `0.28.1`
+ - [#750](https://github.com/influxdata/influxdb-client-java/pull/750): `assertj-core` to `3.26.3`
+ - [#737](https://github.com/influxdata/influxdb-client-java/pull/737): `junit-jupiter` to `5.10.3`
+ - [#754](https://github.com/influxdata/influxdb-client-java/pull/754): `hamcrest` to `3.0`
+
+#### Examples:
+ - [#723](https://github.com/influxdata/influxdb-client-java/pull/723): `commons-cli ` to `1.8.0`
+ - [#742](https://github.com/influxdata/influxdb-client-java/pull/742): `commons-io ` to `2.16.1`
+
+## 7.1.0 [2024-05-17]
+
+### Bug Fixes
+
+1. [#684](https://github.com/influxdata/influxdb-client-java/issues/684): Fix checking for CSV end of table marker when parsing CSV stream to InfluxQLQueryResult, needed for example when parsing the results of a query like "SHOW SERIES".
+2. [#662](https://github.com/influxdata/influxdb-client-java/issues/662): Adds to FluxDsl support for the `|> elapsed(unit)` function.
+3. [#623](https://github.com/influxdata/influxdb-client-java/issues/623): Enables the use of IPv6 addresses.
+4. [#604](https://github.com/influxdata/influxdb-client-java/issues/604): Custom FluxDSL restrictions for regular expressions
+
+### Dependencies
+
+Update dependencies:
+
+#### Build:
+ - [#716](https://github.com/influxdata/influxdb-client-java/pull/716): `karaf` to `4.4.6`
+ - [#710](https://github.com/influxdata/influxdb-client-java/pull/710): `spring-boot` to `3.2.5`
+ - [#686](https://github.com/influxdata/influxdb-client-java/pull/686): `scala-library` to `2.12.19`
+ - [#690](https://github.com/influxdata/influxdb-client-java/pull/690): `kotlinx-coroutines` to `1.8.0`
+ - [#707](https://github.com/influxdata/influxdb-client-java/pull/707): `micrometer-registry-influx` to `1.12.5`
+ - [#696](https://github.com/influxdata/influxdb-client-java/pull/696): `okio` to `3.9.0`
+ - [#694](https://github.com/influxdata/influxdb-client-java/pull/694): `retrofit` to `2.11.0`
+ - [#699](https://github.com/influxdata/influxdb-client-java/pull/699): `kotlin` to `1.9.23`
+ - [#701](https://github.com/influxdata/influxdb-client-java/pull/701): `lombok` to `1.18.32`
+ - [#702](https://github.com/influxdata/influxdb-client-java/pull/702): `commons-io` to `2.16.0`
+
+#### Maven:
+ - [#676](https://github.com/influxdata/influxdb-client-java/pull/676): `maven-compiler-plugin` to `3.12.1`
+ - [#677](https://github.com/influxdata/influxdb-client-java/pull/677): `maven-surefire-plugin`, `maven-failsafe-plugin` to `3.2.5`
+ - [#679](https://github.com/influxdata/influxdb-client-java/pull/679): `build-helper-maven-plugin` to `3.5.0`
+ - [#682](https://github.com/influxdata/influxdb-client-java/pull/682): `maven-checkstyle-plugin` to `3.3.1`
+ - [#712](https://github.com/influxdata/influxdb-client-java/pull/712): `maven-gpg-plugin` to `3.2.4`
+ - [#703](https://github.com/influxdata/influxdb-client-java/pull/703): `dokka-maven-plugin` to `1.9.20`
+ - [#713](https://github.com/influxdata/influxdb-client-java/pull/713): `maven-jar-plugin` to `3.4.1`
+ - [#709](https://github.com/influxdata/influxdb-client-java/pull/709): `scala-maven-plugin` to `4.9.0`
+ - [#708](https://github.com/influxdata/influxdb-client-java/pull/708): `maven-deploy-plugin` to `3.1.2`
+
+#### Test:
+ - [#683](https://github.com/influxdata/influxdb-client-java/pull/683): `assertj` to `3.25.3`
+ - [#687](https://github.com/influxdata/influxdb-client-java/pull/687): `junit-jupiter` to `5.10.2`
+ - [#714](https://github.com/influxdata/influxdb-client-java/pull/714): `logback-classic` to `1.5.6`
+
+#### Provided:
+ - [#711](https://github.com/influxdata/influxdb-client-java/pull/711): `slf4j-api` to `2.0.13`
+
+#### Examples:
+ - [#715](https://github.com/influxdata/influxdb-client-java/pull/715): `commons-cli ` to `1.7.0`
+
+## 7.0.0 [2024-01-30]
+
+:warning: This client version discontinues support for JDK 8 and 11. The minimum supported JDK version is now JDK 17.
+
+:warning: This client version discontinues support for Akka Streams and introduces support for Pekko Streams instead. Apache Pekko is a fork of [Akka](https://github.com/akka/akka) 2.6.x, created after the Akka project adopted the Business Source License, which is not compatible with open-source usage.
+
+### Features
+1. [#661](https://github.com/influxdata/influxdb-client-java/pull/661): Replaced Akka Streams with Pekko Streams in the Scala client.
+1. [#673](https://github.com/influxdata/influxdb-client-java/pull/673): Upgrade SpringBoot to v3 and Spring to v6
+1. [#673](https://github.com/influxdata/influxdb-client-java/pull/673): Disable support for old JDKs (< 17)
+
+### Dependencies
+
+Update dependencies:
+
+#### Build:
+ - [#664](https://github.com/influxdata/influxdb-client-java/pull/664): `kotlin` to `1.9.22`
+ - [#666](https://github.com/influxdata/influxdb-client-java/pull/666): `okio` to `3.7.0`
+ - [#667](https://github.com/influxdata/influxdb-client-java/pull/667): `rxjava` to `3.1.8`
+ - [#669](https://github.com/influxdata/influxdb-client-java/pull/669): `commons-lang3` to `3.14.0`
+ - [#670](https://github.com/influxdata/influxdb-client-java/pull/670): `micrometer-registry-influx` to `1.12.1`
+ - [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `spring-boot` to `3.2.2`
+ - [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `spring` to `6.1.3`
+ - [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `scala-library` to `2.13.11`
+ - [#673](https://github.com/influxdata/influxdb-client-java/pull/673): `okhttp` to `4.12.0`
+
+#### Maven:
+ - [#671](https://github.com/influxdata/influxdb-client-java/pull/671): `maven-javadoc-plugin` to `3.6.3`
+
+#### Test:
+ - [#668](https://github.com/influxdata/influxdb-client-java/pull/668): `junit-jupiter` to `5.10.1`
+
## 6.12.0 [2023-12-15]
### Features
diff --git a/README.md b/README.md
index d4b3aaf7763..f9c3a7589d9 100644
--- a/README.md
+++ b/README.md
@@ -53,14 +53,14 @@ This section contains links to the client library documentation.
The Java, Reactive, OSGi, Kotlin and Scala clients are implemented for the InfluxDB 2.x:
-| Client | Description | Documentation | Compatibility |
-| --- | --- | --- | --- |
-| **[java](./client)** | The reference Java client that allows query, write and InfluxDB 2.x management. | [javadoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-java/apidocs/index.html), [readme](./client#influxdb-client-java/)| 2.x |
-| **[reactive](./client-reactive)** | The reference RxJava client for the InfluxDB 2.x that allows query and write in a reactive way.| [javadoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-reactive/apidocs/index.html), [readme](./client-reactive#influxdb-client-reactive/) |2.x |
-| **[kotlin](./client-kotlin)** | The reference Kotlin client that allows query and write for the InfluxDB 2.x by Kotlin [Channel](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-channel/index.html) and [Flow](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html) coroutines. | [KDoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-kotlin/dokka/influxdb-client-kotlin/com.influxdb.client.kotlin/index.html), [readme](./client-kotlin#influxdb-client-kotlin/) | 2.x|
-| **[scala](./client-scala)** | The reference Scala client that allows query and write for the InfluxDB 2.x by [Akka Streams](https://doc.akka.io/docs/akka/2.6/stream/). | [Scaladoc](https://influxdata.github.io/influxdb-client-java/client-scala/cross/influxdb-client-scala_2.13/scaladocs/com/influxdb/client/scala/index.html), [readme](./client-scala#influxdb-client-scala/) | 2.x |
-| **[osgi](./client-osgi)** | The reference OSGi (R6) client embedding Java and reactive clients and providing standard features (declarative services, configuration, event processing) for the InfluxDB 2.x. | [javadoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-osgi/apidocs/index.html), [readme](./client-osgi) | 2.x |
-| **[karaf](./karaf)** | The Apache Karaf feature definition for the InfluxDB 2.x. | [readme](./karaf) | 2.x |
+| Client | Description | Documentation | Compatibility |
+|-----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
+| **[java](./client)** | The reference Java client that allows query, write and InfluxDB 2.x management. | [javadoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-java/apidocs/index.html), [readme](./client#influxdb-client-java/) | 2.x |
+| **[reactive](./client-reactive)** | The reference RxJava client for the InfluxDB 2.x that allows query and write in a reactive way. | [javadoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-reactive/apidocs/index.html), [readme](./client-reactive#influxdb-client-reactive/) | 2.x |
+| **[kotlin](./client-kotlin)** | The reference Kotlin client that allows query and write for the InfluxDB 2.x by Kotlin [Channel](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.channels/-channel/index.html) and [Flow](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html) coroutines. | [KDoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-kotlin/dokka/influxdb-client-kotlin/com.influxdb.client.kotlin/index.html), [readme](./client-kotlin#influxdb-client-kotlin/) | 2.x |
+| **[scala](./client-scala)** | The reference Scala client that allows query and write for the InfluxDB 2.x by [Pekko Streams](https://pekko.apache.org/docs/pekko/current/stream/index.html). | [Scaladoc](https://influxdata.github.io/influxdb-client-java/client-scala/cross/influxdb-client-scala_2.13/scaladocs/com/influxdb/client/scala/index.html), [readme](./client-scala#influxdb-client-scala/) | 2.x |
+| **[osgi](./client-osgi)** | The reference OSGi (R6) client embedding Java and reactive clients and providing standard features (declarative services, configuration, event processing) for the InfluxDB 2.x. | [javadoc](https://influxdata.github.io/influxdb-client-java/influxdb-client-osgi/apidocs/index.html), [readme](./client-osgi) | 2.x |
+| **[karaf](./karaf)** | The Apache Karaf feature definition for the InfluxDB 2.x. | [readme](./karaf) | 2.x |
There is also possibility to use the Flux language over the InfluxDB 1.7+ provided by:
@@ -102,7 +102,7 @@ Download the latest version:
com.influxdbinfluxdb-client-java
- 6.12.0
+ 7.3.0
```
@@ -110,7 +110,7 @@ Download the latest version:
```groovy
dependencies {
- implementation "com.influxdb:influxdb-client-java:6.12.0"
+ implementation "com.influxdb:influxdb-client-java:7.3.0"
}
```
@@ -218,7 +218,7 @@ Download the latest version:
com.influxdbinfluxdb-client-java
- 6.12.0
+ 7.3.0
```
@@ -226,7 +226,7 @@ Download the latest version:
```groovy
dependencies {
- implementation "com.influxdb:influxdb-client-java:6.12.0"
+ implementation "com.influxdb:influxdb-client-java:7.3.0"
}
```
@@ -319,7 +319,7 @@ Download the latest version:
com.influxdbinfluxdb-client-flux
- 6.12.0
+ 7.3.0
```
@@ -327,7 +327,7 @@ Download the latest version:
```groovy
dependencies {
- implementation "com.influxdb:influxdb-client-flux:6.12.0"
+ implementation "com.influxdb:influxdb-client-flux:7.3.0"
}
```
@@ -393,12 +393,12 @@ public class FluxExample {
## Build Requirements
-* Java 1.8+ (tested with jdk8)
+* Java 17+ (tested with JDK 17)
+ * :warning: If you want to use older version of JDK, you have to use the 6.x version of the client.
* Maven 3.0+ (tested with maven 3.5.0)
* Docker daemon running
* The latest InfluxDB 2.x and InfluxDB 1.X docker instances, which can be started using the `./scripts/influxdb-restart.sh` script
-
Once these are in place you can build influxdb-client-java with all tests with:
diff --git a/client-core/pom.xml b/client-core/pom.xml
index fe688ee79d8..64c8b6fa7b2 100644
--- a/client-core/pom.xml
+++ b/client-core/pom.xml
@@ -28,7 +28,7 @@
influxdb-clientcom.influxdb
- 6.12.0
+ 7.4.0-SNAPSHOTinfluxdb-client-core
@@ -66,7 +66,7 @@
scm:git:git@github.com:influxdata/influxdb-client-java.gitscm:git:git@github.com:influxdata/influxdb-client-java.githttps://github.com/influxdata/influxdb-client-java/tree/master
- v6.12.0
+ HEAD
@@ -98,20 +98,6 @@
com.squareup.okiookio
-
-
- org.jetbrains.kotlin
- kotlin-stdlib
-
-
- org.jetbrains.kotlin
- kotlin-stdlib-common
-
-
- org.jetbrains.kotlin
- kotlin-stdlib-jdk8
-
-
diff --git a/client-core/src/main/java/com/influxdb/internal/AbstractQueryApi.java b/client-core/src/main/java/com/influxdb/internal/AbstractQueryApi.java
index dde96fc10be..39ceb0ad940 100644
--- a/client-core/src/main/java/com/influxdb/internal/AbstractQueryApi.java
+++ b/client-core/src/main/java/com/influxdb/internal/AbstractQueryApi.java
@@ -174,13 +174,21 @@ protected void query(@Nonnull final Call query,
Consumer bodyConsumer = body -> {
try {
BufferedSource source = body.source();
-
- //
- // Source has data => parse
- //
- while (source.isOpen() && !source.exhausted() && !cancellable.wasCancelled) {
-
+ // already exhausted - empty or very short response
+ if (source.exhausted()) {
+ LOG.log(Level.WARNING, String.format("Query %s already exhausted.",
+ query.request().tag(retrofit2.Invocation.class)
+ .toString().split(" \\[")[1]
+ .replace("]", "")));
consumer.accept(cancellable, source);
+ } else {
+
+ //
+ // Source has data => parse
+ //
+ while (source.isOpen() && !source.exhausted() && !cancellable.wasCancelled) {
+ consumer.accept(cancellable, source);
+ }
}
if (!cancellable.wasCancelled) {
diff --git a/client-core/src/main/java/com/influxdb/query/InfluxQLQueryResult.java b/client-core/src/main/java/com/influxdb/query/InfluxQLQueryResult.java
index 88c9012e205..4f2fe8f7a1b 100644
--- a/client-core/src/main/java/com/influxdb/query/InfluxQLQueryResult.java
+++ b/client-core/src/main/java/com/influxdb/query/InfluxQLQueryResult.java
@@ -210,7 +210,6 @@ public Object[] getValues() {
return values;
}
}
-
}
}
diff --git a/client-core/src/test/java/com/influxdb/exceptions/InfluxExceptionTest.java b/client-core/src/test/java/com/influxdb/exceptions/InfluxExceptionTest.java
index df1619a379f..74afe1e8a1c 100644
--- a/client-core/src/test/java/com/influxdb/exceptions/InfluxExceptionTest.java
+++ b/client-core/src/test/java/com/influxdb/exceptions/InfluxExceptionTest.java
@@ -322,6 +322,32 @@ void messageContainsHttpErrorCode() {
.matches((Predicate) throwable -> throwable.toString().equals("com.influxdb.exceptions.InfluxException: HTTP status code: 501; Message: Wrong query"));
}
+ @Test
+ void exceptionContainsHttpResponseHeaders() {
+ Assertions.assertThatThrownBy(() -> {
+ Response