allthingssecurity opened a new pull request, #30994:
URL: https://github.com/apache/camel/pull/30994

   # Description
   
   [CAMEL-27606](https://issues.apache.org/jira/browse/CAMEL-27606)
   
   The ticket lists five problems of camel-influxdb2 that came up while the 
option descriptions were written for CAMEL-23832 (#30936). I checked each one 
against main. Three are fixed here, two are left as they are.
   
   Fixed:
   1. **A PING endpoint needed an organization and a bucket, and created them 
at startup.** `doInit()` ran `ensureOrgExists()` and `ensureBucketExists()` for 
every endpoint, also for `operation=PING`, which uses neither. With the 
defaults a ping endpoint looked both up 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 that switches a ping endpoint to insert), 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 the options 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). Without `org`, it fails with `autoCreateOrg`, or with 
`autoCreateBucket` and a bucket that does not exist yet; without `bucket`, it 
fails with `autoCreateBucket`. The `CamelInfluxDB2Org` and 
`CamelInfluxDB2Bucket` headers can replace the options only for an endpoint 
that creates neither.
   5. **Display name of influxDBClient.** It is now `InfluxDB Client` instead 
of the generated `Influx DBClient`.
   
   Not changed:
   2. **writePrecision has no effect for Point, Map and Points bodies.** A 
`Point` carries its own precision (`Point.time(...)`), which the endpoint 
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. #30936 documents this in the descriptions of the 
option and the header.
   3. **CamelInfluxDB2MeasurementName is a Map key, not a header.** Removing 
its `@Metadata` would remove the generated Endpoint DSL header method, which 
user code may call. #30936 describes it as the key of the Map body.
   
   Upgrade guide (4.24): a ping endpoint no longer looks up or creates the 
organization and the bucket at startup, and `org` and `bucket` are no longer 
marked required; an INSERT endpoint still needs them unless `autoCreateOrg` and 
`autoCreateBucket` are false and the headers name the organization and the 
bucket. The entry sits next to the other camel-influxdb2 entry of 4.24.
   
   Overlap with #30936: both change the `@Metadata` of `org`, `bucket` and 
`influxDBClient` and the generated files, so whichever is merged second needs a 
small rebase. With this change, these texts in #30936 are no longer exact: 
`org` and `bucket` keep `required = true` there; the `org` description says 
"The autoCreateOrg and autoCreateBucket options use this organization when the 
endpoint starts", and the `autoCreateOrg` and `autoCreateBucket` descriptions 
say the endpoint looks them up when it starts. None of this happens for a PING 
endpoint now.
   
   Tests (added to `InfluxDb2EndpointStartupTest`, which plays InfluxDB with a 
local HTTP server, no Docker):
   - a ping endpoint without `org` and `bucket` starts and sends no request; a 
ping endpoint with an `org` and a `bucket` that do not exist starts and creates 
neither; the component JSON has `org` and `bucket` not required and the 
`InfluxDB Client` display name. Against the main sources all 3 fail (the route 
fails to start, the organization and the bucket are looked up and created, the 
metadata is unchanged).
   
   Results (offline, module build of camel-influxdb2, test phase): 41 tests 
run, 0 failures, 0 errors. The test class passes 5 runs in a row.
   
   Generated files: `influxdb2.json` of the component and its catalog copy, and 
the javadoc of `org` and `bucket` in `InfluxDb2EndpointBuilderFactory`.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it): 
[CAMEL-27606](https://issues.apache.org/jira/browse/CAMEL-27606).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
     (I built camel-influxdb2 and ran its unit tests, and committed the 
regenerated component JSON. The catalog copy and the endpoint DSL were updated 
to match, as an offline build of those modules was not possible here; the 
endpoint DSL file was generated by the camel-package-maven-plugin goal from the 
updated catalog JSON. I did not run the full root build.)
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
     This PR was prepared with Claude Code (Claude Opus 5.5). The commit 
carries a `Co-Authored-By` trailer.
   
   _Claude Code on behalf of allthingssecurity_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to