This is an automated email from the ASF dual-hosted git repository.
davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 513a0329e9aa CAMEL-27606: camel-influxdb2 - a ping endpoint needs no
org and bucket, display name of influxDBClient (#30994)
513a0329e9aa is described below
commit 513a0329e9aa1ae5c6689cbc2ad7d49e3314dc04
Author: allthingssecurity <[email protected]>
AuthorDate: Fri Nov 27 22:16:27 2026 +0530
CAMEL-27606: camel-influxdb2 - a ping endpoint needs no org and bucket,
display name of influxDBClient (#30994)
1. doInit() ran ensureOrgExists() and ensureBucketExists() for every
endpoint, also for operation=PING, which uses neither. With the defaults
a ping endpoint looked the organization and the bucket up at startup and
created them when missing, and without org it failed to start
(createOrganization(null) throws an IllegalArgumentException). The
operation is an endpoint option only (there is no header for it), so
doInit() now skips both checks for PING.
4. org and bucket were marked required, also for PING. The required flag
is dropped and the descriptions say when they are needed: an INSERT
endpoint fails to start without them when it creates a missing
organization or bucket at startup (autoCreateOrg and autoCreateBucket,
both true by default). The CamelInfluxDB2Org and CamelInfluxDB2Bucket
headers can replace them only for an endpoint that creates neither.
5. The component option influxDBClient has displayName InfluxDB Client
instead of the generated Influx DBClient.
Not changed:
2. writePrecision and its header have no effect for Point, Map and Points
bodies. A Point carries its own precision (Point.time), which the option
should not override, and the Point that the converter builds from a Map
has no timestamp (InfluxDB sets the time of the write), so the precision
has nothing to apply to. The descriptions pull request for CAMEL-23832
(#30936) documents this.
3. CamelInfluxDB2MeasurementName is a key of the Map body, not a header.
Removing its @Metadata would remove the generated Endpoint DSL header
method, which user code may call; #30936 describes it as the Map key.
Regenerated influxdb2.json (component and catalog copy) and the endpoint
DSL javadoc of org and bucket. Upgrade guide entry for 4.24 for points 1
and 4.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
.../apache/camel/catalog/components/influxdb2.json | 10 +++---
.../camel/component/influxdb2/influxdb2.json | 10 +++---
.../component/influxdb2/InfluxDb2Component.java | 2 +-
.../component/influxdb2/InfluxDb2Endpoint.java | 24 +++++++++------
.../influxdb2/InfluxDb2EndpointStartupTest.java | 36 ++++++++++++++++++++++
.../ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 13 ++++++++
.../dsl/InfluxDb2EndpointBuilderFactory.java | 29 ++++++++++-------
7 files changed, 93 insertions(+), 31 deletions(-)
diff --git
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/influxdb2.json
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/influxdb2.json
index 854a26db924e..a77cdb1dc525 100644
---
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/influxdb2.json
+++
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/influxdb2.json
@@ -24,7 +24,7 @@
"remote": true
},
"componentProperties": {
- "influxDBClient": { "index": 0, "kind": "property", "displayName": "Influx
DBClient", "group": "producer", "label": "", "required": false, "type":
"object", "javaType": "com.influxdb.client.InfluxDBClient", "deprecated":
false, "autowired": true, "secret": false, "description": "The
com.influxdb.client.InfluxDBClient that all endpoints use. When it is set or
autowired, the connectionBean of an endpoint is not looked up in the registry.
The component does not close this client." },
+ "influxDBClient": { "index": 0, "kind": "property", "displayName":
"InfluxDB Client", "group": "producer", "label": "", "required": false, "type":
"object", "javaType": "com.influxdb.client.InfluxDBClient", "deprecated":
false, "autowired": true, "secret": false, "description": "The
com.influxdb.client.InfluxDBClient that all endpoints use. When it is set or
autowired, the connectionBean of an endpoint is not looked up in the registry.
The component does not close this client." },
"lazyStartProducer": { "index": 1, "kind": "property", "displayName":
"Lazy Start Producer", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether the producer should be started lazy (on the first message). By
starting lazy you can use this to allow CamelContext and routes to startup in
situations where a producer may otherwise fail [...]
"autowiredEnabled": { "index": 2, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching t [...]
},
@@ -41,11 +41,11 @@
},
"properties": {
"connectionBean": { "index": 0, "kind": "path", "displayName": "Connection
Bean", "group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The name of the
com.influxdb.client.InfluxDBClient bean to look up in the registry. It is not
looked up when the component has a client, set with its influxDBClient option
or autowired." },
- "autoCreateBucket": { "index": 1, "kind": "parameter", "displayName":
"Auto Create Bucket", "group": "producer", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "description": "Whether the
endpoint looks up the bucket of the bucket option when it starts, and creates
it in the organization of the org option when it does not exist. If
autoCreateOrg is false and that organization do [...]
- "autoCreateOrg": { "index": 2, "kind": "parameter", "displayName": "Auto
Create Org", "group": "producer", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the endpoint
looks up the organization of the org option when it starts, and creates it when
it does not exist. An organization that the CamelInfluxDB2Org header names is
not created." },
- "bucket": { "index": 3, "kind": "parameter", "displayName": "Bucket",
"group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The name of the bucket to write to. The
CamelInfluxDB2Bucket header replaces this option for a write. The
autoCreateBucket option uses this bucket when the endpoint starts." },
+ "autoCreateBucket": { "index": 1, "kind": "parameter", "displayName":
"Auto Create Bucket", "group": "producer", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "description": "Whether the
endpoint looks up the bucket of the bucket option when it starts, and creates
it in the organization of the org option when it does not exist. If
autoCreateOrg is false and that organization do [...]
+ "autoCreateOrg": { "index": 2, "kind": "parameter", "displayName": "Auto
Create Org", "group": "producer", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the endpoint
looks up the organization of the org option when it starts, and creates it when
it does not exist. An organization that the CamelInfluxDB2Org header names is
not created. Not used by the PIN [...]
+ "bucket": { "index": 3, "kind": "parameter", "displayName": "Bucket",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The name of the bucket to write to. The
CamelInfluxDB2Bucket header replaces this option for a write, so the option can
be left out when autoCreateBucket is false. The autoCreateBucket option uses
this bucket when the endpoint starts, and th [...]
"operation": { "index": 4, "kind": "parameter", "displayName":
"Operation", "group": "producer", "label": "", "required": false, "type":
"enum", "javaType": "org.apache.camel.component.influxdb2.enums.Operation",
"enum": [ "INSERT", "PING" ], "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "INSERT", "description": "The operation of the
producer. INSERT writes the body to the bucket. PING calls the ping endpoint of
InfluxDB and sets the body to a Boolean: tru [...]
- "org": { "index": 5, "kind": "parameter", "displayName": "Org", "group":
"producer", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the organization to write to. The CamelInfluxDB2Org
header replaces this option for a write. The autoCreateOrg and autoCreateBucket
options use this organization when the endpoint starts." },
+ "org": { "index": 5, "kind": "parameter", "displayName": "Org", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the organization to write to. The CamelInfluxDB2Org
header replaces this option for a write, so the option can be left out when
autoCreateOrg and autoCreateBucket are false. The autoCreateOrg and
autoCreateBucket options use this organ [...]
"retentionPolicy": { "index": 6, "kind": "parameter", "displayName":
"Retention Policy", "group": "producer", "label": "", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": true,
"deprecationNote": "Never read by the component: the InfluxDB 2.x write API has
no retention policy, retention is a property of the bucket", "autowired":
false, "secret": false, "defaultValue": "default", "description": "The name of
a retention policy, which InfluxDB 1.x has [...]
"writePrecision": { "index": 7, "kind": "parameter", "displayName": "Write
Precision", "group": "producer", "label": "", "required": false, "type":
"enum", "javaType": "com.influxdb.client.domain.WritePrecision", "enum": [
"ms", "s", "us", "ns" ], "deprecated": false, "autowired": false, "secret":
false, "defaultValue": "ms", "description": "The precision of the timestamps in
a Measurement, Record, Measurements or Records body. It does not apply to a
Point, a Map or a Points body, as [...]
"lazyStartProducer": { "index": 8, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
diff --git
a/components/camel-influxdb2/src/generated/resources/META-INF/org/apache/camel/component/influxdb2/influxdb2.json
b/components/camel-influxdb2/src/generated/resources/META-INF/org/apache/camel/component/influxdb2/influxdb2.json
index 854a26db924e..a77cdb1dc525 100644
---
a/components/camel-influxdb2/src/generated/resources/META-INF/org/apache/camel/component/influxdb2/influxdb2.json
+++
b/components/camel-influxdb2/src/generated/resources/META-INF/org/apache/camel/component/influxdb2/influxdb2.json
@@ -24,7 +24,7 @@
"remote": true
},
"componentProperties": {
- "influxDBClient": { "index": 0, "kind": "property", "displayName": "Influx
DBClient", "group": "producer", "label": "", "required": false, "type":
"object", "javaType": "com.influxdb.client.InfluxDBClient", "deprecated":
false, "autowired": true, "secret": false, "description": "The
com.influxdb.client.InfluxDBClient that all endpoints use. When it is set or
autowired, the connectionBean of an endpoint is not looked up in the registry.
The component does not close this client." },
+ "influxDBClient": { "index": 0, "kind": "property", "displayName":
"InfluxDB Client", "group": "producer", "label": "", "required": false, "type":
"object", "javaType": "com.influxdb.client.InfluxDBClient", "deprecated":
false, "autowired": true, "secret": false, "description": "The
com.influxdb.client.InfluxDBClient that all endpoints use. When it is set or
autowired, the connectionBean of an endpoint is not looked up in the registry.
The component does not close this client." },
"lazyStartProducer": { "index": 1, "kind": "property", "displayName":
"Lazy Start Producer", "group": "producer", "label": "producer", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": false, "description":
"Whether the producer should be started lazy (on the first message). By
starting lazy you can use this to allow CamelContext and routes to startup in
situations where a producer may otherwise fail [...]
"autowiredEnabled": { "index": 2, "kind": "property", "displayName":
"Autowired Enabled", "group": "advanced", "label": "advanced", "required":
false, "type": "boolean", "javaType": "boolean", "deprecated": false,
"autowired": false, "secret": false, "defaultValue": true, "description":
"Whether autowiring is enabled. This is used for automatic autowiring options
(the option must be marked as autowired) by looking up in the registry to find
if there is a single instance of matching t [...]
},
@@ -41,11 +41,11 @@
},
"properties": {
"connectionBean": { "index": 0, "kind": "path", "displayName": "Connection
Bean", "group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The name of the
com.influxdb.client.InfluxDBClient bean to look up in the registry. It is not
looked up when the component has a client, set with its influxDBClient option
or autowired." },
- "autoCreateBucket": { "index": 1, "kind": "parameter", "displayName":
"Auto Create Bucket", "group": "producer", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "description": "Whether the
endpoint looks up the bucket of the bucket option when it starts, and creates
it in the organization of the org option when it does not exist. If
autoCreateOrg is false and that organization do [...]
- "autoCreateOrg": { "index": 2, "kind": "parameter", "displayName": "Auto
Create Org", "group": "producer", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the endpoint
looks up the organization of the org option when it starts, and creates it when
it does not exist. An organization that the CamelInfluxDB2Org header names is
not created." },
- "bucket": { "index": 3, "kind": "parameter", "displayName": "Bucket",
"group": "producer", "label": "", "required": true, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The name of the bucket to write to. The
CamelInfluxDB2Bucket header replaces this option for a write. The
autoCreateBucket option uses this bucket when the endpoint starts." },
+ "autoCreateBucket": { "index": 1, "kind": "parameter", "displayName":
"Auto Create Bucket", "group": "producer", "label": "", "required": false,
"type": "boolean", "javaType": "boolean", "deprecated": false, "autowired":
false, "secret": false, "defaultValue": true, "description": "Whether the
endpoint looks up the bucket of the bucket option when it starts, and creates
it in the organization of the org option when it does not exist. If
autoCreateOrg is false and that organization do [...]
+ "autoCreateOrg": { "index": 2, "kind": "parameter", "displayName": "Auto
Create Org", "group": "producer", "label": "", "required": false, "type":
"boolean", "javaType": "boolean", "deprecated": false, "autowired": false,
"secret": false, "defaultValue": true, "description": "Whether the endpoint
looks up the organization of the org option when it starts, and creates it when
it does not exist. An organization that the CamelInfluxDB2Org header names is
not created. Not used by the PIN [...]
+ "bucket": { "index": 3, "kind": "parameter", "displayName": "Bucket",
"group": "producer", "label": "", "required": false, "type": "string",
"javaType": "java.lang.String", "deprecated": false, "autowired": false,
"secret": false, "description": "The name of the bucket to write to. The
CamelInfluxDB2Bucket header replaces this option for a write, so the option can
be left out when autoCreateBucket is false. The autoCreateBucket option uses
this bucket when the endpoint starts, and th [...]
"operation": { "index": 4, "kind": "parameter", "displayName":
"Operation", "group": "producer", "label": "", "required": false, "type":
"enum", "javaType": "org.apache.camel.component.influxdb2.enums.Operation",
"enum": [ "INSERT", "PING" ], "deprecated": false, "autowired": false,
"secret": false, "defaultValue": "INSERT", "description": "The operation of the
producer. INSERT writes the body to the bucket. PING calls the ping endpoint of
InfluxDB and sets the body to a Boolean: tru [...]
- "org": { "index": 5, "kind": "parameter", "displayName": "Org", "group":
"producer", "label": "", "required": true, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the organization to write to. The CamelInfluxDB2Org
header replaces this option for a write. The autoCreateOrg and autoCreateBucket
options use this organization when the endpoint starts." },
+ "org": { "index": 5, "kind": "parameter", "displayName": "Org", "group":
"producer", "label": "", "required": false, "type": "string", "javaType":
"java.lang.String", "deprecated": false, "autowired": false, "secret": false,
"description": "The name of the organization to write to. The CamelInfluxDB2Org
header replaces this option for a write, so the option can be left out when
autoCreateOrg and autoCreateBucket are false. The autoCreateOrg and
autoCreateBucket options use this organ [...]
"retentionPolicy": { "index": 6, "kind": "parameter", "displayName":
"Retention Policy", "group": "producer", "label": "", "required": false,
"type": "string", "javaType": "java.lang.String", "deprecated": true,
"deprecationNote": "Never read by the component: the InfluxDB 2.x write API has
no retention policy, retention is a property of the bucket", "autowired":
false, "secret": false, "defaultValue": "default", "description": "The name of
a retention policy, which InfluxDB 1.x has [...]
"writePrecision": { "index": 7, "kind": "parameter", "displayName": "Write
Precision", "group": "producer", "label": "", "required": false, "type":
"enum", "javaType": "com.influxdb.client.domain.WritePrecision", "enum": [
"ms", "s", "us", "ns" ], "deprecated": false, "autowired": false, "secret":
false, "defaultValue": "ms", "description": "The precision of the timestamps in
a Measurement, Record, Measurements or Records body. It does not apply to a
Point, a Map or a Points body, as [...]
"lazyStartProducer": { "index": 8, "kind": "parameter", "displayName":
"Lazy Start Producer", "group": "producer (advanced)", "label":
"producer,advanced", "required": false, "type": "boolean", "javaType":
"boolean", "deprecated": false, "autowired": false, "secret": false,
"defaultValue": false, "description": "Whether the producer should be started
lazy (on the first message). By starting lazy you can use this to allow
CamelContext and routes to startup in situations where a produc [...]
diff --git
a/components/camel-influxdb2/src/main/java/org/apache/camel/component/influxdb2/InfluxDb2Component.java
b/components/camel-influxdb2/src/main/java/org/apache/camel/component/influxdb2/InfluxDb2Component.java
index f4030bd8abc4..01f1eb35b487 100644
---
a/components/camel-influxdb2/src/main/java/org/apache/camel/component/influxdb2/InfluxDb2Component.java
+++
b/components/camel-influxdb2/src/main/java/org/apache/camel/component/influxdb2/InfluxDb2Component.java
@@ -28,7 +28,7 @@ import org.apache.camel.support.DefaultComponent;
@Component("influxdb2")
public class InfluxDb2Component extends DefaultComponent {
- @Metadata(autowired = true,
+ @Metadata(autowired = true, displayName = "InfluxDB Client",
description = "The com.influxdb.client.InfluxDBClient that all
endpoints use. When it is set or autowired,"
+ " the connectionBean of an endpoint is not
looked up in the registry. The component does not"
+ " close this client.")
diff --git
a/components/camel-influxdb2/src/main/java/org/apache/camel/component/influxdb2/InfluxDb2Endpoint.java
b/components/camel-influxdb2/src/main/java/org/apache/camel/component/influxdb2/InfluxDb2Endpoint.java
index a826dad579d0..b76d45dd35e0 100644
---
a/components/camel-influxdb2/src/main/java/org/apache/camel/component/influxdb2/InfluxDb2Endpoint.java
+++
b/components/camel-influxdb2/src/main/java/org/apache/camel/component/influxdb2/InfluxDb2Endpoint.java
@@ -75,15 +75,17 @@ public class InfluxDb2Endpoint extends DefaultEndpoint {
+ " autowired.")
private String connectionBean;
@UriParam
- @Metadata(required = true,
- description = "The name of the organization to write to. The
CamelInfluxDB2Org header replaces this option"
- + " for a write. The autoCreateOrg and
autoCreateBucket options use this organization when the"
- + " endpoint starts.")
+ @Metadata(description = "The name of the organization to write to. The
CamelInfluxDB2Org header replaces this option"
+ + " for a write, so the option can be left out
when autoCreateOrg and autoCreateBucket are false."
+ + " The autoCreateOrg and autoCreateBucket options
use this organization when the endpoint"
+ + " starts: with autoCreateOrg, or with
autoCreateBucket and a bucket that does not exist yet, the"
+ + " endpoint fails to start without it. Not used
by the PING operation.")
private String org;
@UriParam
- @Metadata(required = true,
- description = "The name of the bucket to write to. The
CamelInfluxDB2Bucket header replaces this option for a"
- + " write. The autoCreateBucket option uses this
bucket when the endpoint starts.")
+ @Metadata(description = "The name of the bucket to write to. The
CamelInfluxDB2Bucket header replaces this option for a"
+ + " write, so the option can be left out when
autoCreateBucket is false. The autoCreateBucket"
+ + " option uses this bucket when the endpoint
starts, and the endpoint fails to start without"
+ + " it. Not used by the PING operation.")
private String bucket;
@UriParam(defaultValue = "default",
description = "The name of a retention policy, which InfluxDB
1.x has and InfluxDB 2.x does not.")
@@ -100,14 +102,14 @@ public class InfluxDb2Endpoint extends DefaultEndpoint {
@UriParam(defaultValue = "true",
description = "Whether the endpoint looks up the organization of
the org option when it starts, and creates"
+ " it when it does not exist. An organization
that the CamelInfluxDB2Org header names is not"
- + " created.")
+ + " created. Not used by the PING operation.")
private boolean autoCreateOrg = true;
@UriParam(defaultValue = "true",
description = "Whether the endpoint looks up the bucket of the
bucket option when it starts, and creates it in"
+ " the organization of the org option when it
does not exist. If autoCreateOrg is false and"
+ " that organization does not exist, the endpoint
fails to start. A bucket that the"
- + " CamelInfluxDB2Bucket header names is not
created.")
+ + " CamelInfluxDB2Bucket header names is not
created. Not used by the PING operation.")
private boolean autoCreateBucket = true;
@UriParam(defaultValue = "ms",
@@ -228,6 +230,10 @@ public class InfluxDb2Endpoint extends DefaultEndpoint {
super.doInit();
// InfluxDB is called at startup only to create the organization or
the bucket when it is missing. A write names
// the organization and the bucket, so an endpoint that creates
neither does not need the server to start.
+ if (operation == Operation.PING) {
+ // a ping uses neither the organization nor the bucket
+ return;
+ }
if (autoCreateOrg) {
ensureOrgExists();
}
diff --git
a/components/camel-influxdb2/src/test/java/org/apache/camel/component/influxdb2/InfluxDb2EndpointStartupTest.java
b/components/camel-influxdb2/src/test/java/org/apache/camel/component/influxdb2/InfluxDb2EndpointStartupTest.java
index f85e059de207..f0bd448a688f 100644
---
a/components/camel-influxdb2/src/test/java/org/apache/camel/component/influxdb2/InfluxDb2EndpointStartupTest.java
+++
b/components/camel-influxdb2/src/test/java/org/apache/camel/component/influxdb2/InfluxDb2EndpointStartupTest.java
@@ -23,6 +23,7 @@ import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.nio.charset.StandardCharsets;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -32,10 +33,13 @@ import com.influxdb.client.write.Point;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpServer;
import org.apache.camel.CamelContext;
+import org.apache.camel.CatalogCamelContext;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit6.CamelTestSupport;
import org.apache.camel.util.ObjectHelper;
+import org.apache.camel.util.json.JsonObject;
+import org.apache.camel.util.json.Jsoner;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
@@ -210,6 +214,38 @@ class InfluxDb2EndpointStartupTest extends
CamelTestSupport {
"requests when the route has failed to start");
}
+ @Test
+ void pingEndpointNeedsNoOrganizationOrBucket() throws Exception {
+ orgExists.set(false);
+ bucketExists.set(false);
+
+ assertDoesNotThrow(() ->
addRouteTo("influxdb2:influxDbBean?operation=PING"));
+
+ assertEquals(List.of(), requests, "requests when the route has
started");
+ }
+
+ @Test
+ void pingEndpointDoesNotCreateTheOrganizationOrTheBucket() throws
Exception {
+ orgExists.set(false);
+ bucketExists.set(false);
+
+
addRouteTo("influxdb2:influxDbBean?operation=PING&org=myOrg&bucket=myBucket");
+
+ assertEquals(List.of(), requests, "requests when the route has
started");
+ }
+
+ @Test
+ void organizationAndBucketAreNotRequiredOptions() throws Exception {
+ JsonObject json = (JsonObject) Jsoner.deserialize(
+ ((CatalogCamelContext)
context).getComponentParameterJsonSchema("influxdb2"));
+ Map<String, Object> properties = json.getMap("properties");
+ Map<String, Object> componentProperties =
json.getMap("componentProperties");
+
+ assertEquals(Boolean.FALSE, ((Map<?, ?>)
properties.get("org")).get("required"));
+ assertEquals(Boolean.FALSE, ((Map<?, ?>)
properties.get("bucket")).get("required"));
+ assertEquals("InfluxDB Client", ((Map<?, ?>)
componentProperties.get("influxDBClient")).get("displayName"));
+ }
+
private void addRouteTo(String uri) throws Exception {
context.addRoutes(new RouteBuilder() {
@Override
diff --git
a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
index 3593d999c6f3..c6841839ea40 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc
@@ -11857,6 +11857,19 @@ Both are now deprecated with a note that says so.
Remove `retentionPolicy` from
header: they are silently ignored. To control how long the data is kept, set
the retention period on the bucket the
endpoint writes to.
+=== camel-influxdb2 - a ping endpoint does not look up or create the
organization and the bucket
+
+An `influxdb2` endpoint with `operation=PING` no longer looks up, or creates,
the organization of the `org` option and
+the bucket of the `bucket` option when it starts. A ping uses neither, so such
an endpoint now starts without them and
+does not call InfluxDB at startup. Before, it failed to start without an
`org`, unless `autoCreateOrg` and
+`autoCreateBucket` were both false. Create the organization and the bucket
with an `INSERT` endpoint, or in InfluxDB,
+if a route relied on a ping endpoint to create them.
+
+The `org` and `bucket` options are no longer marked as required. An `INSERT`
endpoint still needs them when it creates
+a missing organization or bucket at startup, which it does by default. Leave
them out of an `INSERT` endpoint only with
+`autoCreateOrg` and `autoCreateBucket` set to false, and name the organization
and the bucket of each write with the
+`CamelInfluxDB2Org` and `CamelInfluxDB2Bucket` headers.
+
=== camel-language - the CamelLanguageScript header is used once and removed
With `allowTemplateFromHeader=true`, a script from the `CamelLanguageScript`
header is now used for that message only.
diff --git
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfluxDb2EndpointBuilderFactory.java
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfluxDb2EndpointBuilderFactory.java
index 2f6e6c386631..3ab6fade68a5 100644
---
a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfluxDb2EndpointBuilderFactory.java
+++
b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/InfluxDb2EndpointBuilderFactory.java
@@ -49,7 +49,8 @@ public interface InfluxDb2EndpointBuilderFactory {
* starts, and creates it in the organization of the org option when it
* does not exist. If autoCreateOrg is false and that organization does
* not exist, the endpoint fails to start. A bucket that the
- * CamelInfluxDB2Bucket header names is not created.
+ * CamelInfluxDB2Bucket header names is not created. Not used by the
+ * PING operation.
*
* The option is a: <code>boolean</code> type.
*
@@ -68,7 +69,8 @@ public interface InfluxDb2EndpointBuilderFactory {
* starts, and creates it in the organization of the org option when it
* does not exist. If autoCreateOrg is false and that organization does
* not exist, the endpoint fails to start. A bucket that the
- * CamelInfluxDB2Bucket header names is not created.
+ * CamelInfluxDB2Bucket header names is not created. Not used by the
+ * PING operation.
*
* The option will be converted to a <code>boolean</code> type.
*
@@ -85,7 +87,8 @@ public interface InfluxDb2EndpointBuilderFactory {
/**
* Whether the endpoint looks up the organization of the org option
when
* it starts, and creates it when it does not exist. An organization
- * that the CamelInfluxDB2Org header names is not created.
+ * that the CamelInfluxDB2Org header names is not created. Not used by
+ * the PING operation.
*
* The option is a: <code>boolean</code> type.
*
@@ -102,7 +105,8 @@ public interface InfluxDb2EndpointBuilderFactory {
/**
* Whether the endpoint looks up the organization of the org option
when
* it starts, and creates it when it does not exist. An organization
- * that the CamelInfluxDB2Org header names is not created.
+ * that the CamelInfluxDB2Org header names is not created. Not used by
+ * the PING operation.
*
* The option will be converted to a <code>boolean</code> type.
*
@@ -118,12 +122,13 @@ public interface InfluxDb2EndpointBuilderFactory {
}
/**
* The name of the bucket to write to. The CamelInfluxDB2Bucket header
- * replaces this option for a write. The autoCreateBucket option uses
- * this bucket when the endpoint starts.
+ * replaces this option for a write, so the option can be left out when
+ * autoCreateBucket is false. The autoCreateBucket option uses this
+ * bucket when the endpoint starts, and the endpoint fails to start
+ * without it. Not used by the PING operation.
*
* The option is a: <code>java.lang.String</code> type.
*
- * Required: true
* Group: producer
*
* @param bucket the value to set
@@ -173,13 +178,15 @@ public interface InfluxDb2EndpointBuilderFactory {
}
/**
* The name of the organization to write to. The CamelInfluxDB2Org
- * header replaces this option for a write. The autoCreateOrg and
- * autoCreateBucket options use this organization when the endpoint
- * starts.
+ * header replaces this option for a write, so the option can be left
+ * out when autoCreateOrg and autoCreateBucket are false. The
+ * autoCreateOrg and autoCreateBucket options use this organization
when
+ * the endpoint starts: with autoCreateOrg, or with autoCreateBucket
and
+ * a bucket that does not exist yet, the endpoint fails to start
without
+ * it. Not used by the PING operation.
*
* The option is a: <code>java.lang.String</code> type.
*
- * Required: true
* Group: producer
*
* @param org the value to set