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

   # Description
   
   [CAMEL-27624](https://issues.apache.org/jira/browse/CAMEL-27624)
   
   The ticket lists five problems of camel-arangodb found while the option 
descriptions were written for CAMEL-23832 (#30963). I checked each one against 
main and all five are real. All are fixed here.
   
   1. **An endpoint shut down a client it did not create.** `doShutdown()` 
called `arangoDB.shutdown()` on any client, also one set on the endpoint, set 
on the component or autowired, which the component hands to every endpoint. 
Shutting down one endpoint (a removed route, or a `toD` endpoint evicted from 
the endpoint cache) made the other endpoints fail with "Connection pool already 
closed!". The endpoint now shuts down only a client it built itself in 
`doStart()`.
   2. **host without port connected to port 0.** The endpoint started and every 
message failed. Without an `arangoDB` client, the endpoint now fails to start 
when `host` or `port` is missing, and the error names the options. I chose the 
error over a default port of 8529 because the description in #30963 says host 
and port must be set together.
   3. **getServiceUrl() returned `null:0`** with a client and no host. It now 
returns null in that case, which `EndpointServiceLocation` allows.
   4. **The database path field of the endpoint was never set.** The `@UriPath` 
moves to `ArangoDbConfiguration.database`, which the component already sets and 
the producer reads, and the dead endpoint field is removed. The path parameter 
in the JSON metadata is unchanged apart from the `configurationClass` and 
`configurationField` that the other options of the configuration also carry.
   5. **host and port are not marked required.** They cannot be, since a client 
replaces them. The startup check of point 2 covers this: the error now names 
the options instead of the driver's "No host has been set!".
   
   User-visible changes are in the 4.24 upgrade guide: a client that was set or 
autowired is no longer shut down by the endpoint, and a missing host or port 
fails at startup.
   
   This touches the same generated JSON as #30963. Whichever is merged second 
needs a small rebase. The `arangoDB` descriptions in #30963 say that each 
endpoint shuts the client down, which is no longer true after this change. 
#30963 also rewrites the `@UriPath` description of `ArangoDbEndpoint.database`, 
the field that this commit removes (point 4), so in whichever PR is merged 
second that description has to move to `ArangoDbConfiguration.database`.
   
   Tests (new, in `ArangoDbProducerTest`, against the fake ArangoDB HTTP server 
the test already uses, no Docker):
   - `sharedClientKeepsWorkingWhenAnotherEndpointShutsDown`
   - `endpointShutsDownTheClientItBuilt`
   - `hostWithoutPortFailsToStart` and `noHostNorClientFailsToStart`
   - `serviceUrlIsNullWithoutHost`
   
   Against the main sources all 5 fail ("Connection pool already closed!", no 
error at start, the driver's "No host has been set!", `null:0`, the built 
client kept after shutdown).
   
   Results (offline, camel-arangodb with camel-test-infra-arangodb in the 
reactor, test phase, Docker ITs not run): 11 unit tests run, 0 failures, 0 
errors. `ArangoDbProducerTest` passes 5 runs in a row.
   
   Generated files: `arangodb.json` of the component and its catalog copy.
   
   Review follow-up (61d0eabc): the tests shut down the ArangoDB clients they 
bind, and the upgrade guide shows how an application shuts down its own client. 
Main merged in after #30963: its database text moved to ArangoDbConfiguration, 
and arangoDB says the endpoints do not shut the client down.
   
   # 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-27624](https://issues.apache.org/jira/browse/CAMEL-27624).
   
   # 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-arangodb and ran its unit tests, and committed the 
regenerated component JSON and its catalog copy. 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). Each 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