[ 
https://issues.apache.org/jira/browse/CAMEL-27624?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claus Ibsen updated CAMEL-27624:
--------------------------------
    Fix Version/s: 4.24.0
                       (was: 4.25.0)

> camel-arangodb: endpoint shuts down a shared client, host without port uses 
> port 0
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-27624
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27624
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-arangodb
>            Reporter: Claus Ibsen
>            Assignee: shashank
>            Priority: Minor
>             Fix For: 4.24.0
>
>
> Found while improving the option descriptions of camel-arangodb for 
> CAMEL-23832 (PR https://github.com/apache/camel/pull/30963).
> These are separate problems of the component; the descriptions PR only 
> documents the current behavior.
> h4. 1. An endpoint shuts down an ArangoDB client that it did not create
> {{ArangoDbEndpoint.doShutdown()}} calls {{arangoDB.shutdown()}} on any 
> client, also one that was set on the endpoint, set on the component or 
> autowired from the registry. {{ArangoDbComponent.createEndpoint()}} passes 
> the component client to every endpoint, so all endpoints share it. When one 
> endpoint is shut down while the others keep running (a route is removed, or a 
> {{toD}} endpoint is evicted from the endpoint cache), the shared client is 
> closed and the other endpoints fail on their next message.
> Proposed change: only shut down a client that the endpoint built itself in 
> {{doStart()}}, and leave a client that was set or autowired to its owner.
> h4. 2. Setting host without port connects to port 0
> {{ArangoDbConfiguration.port}} is an {{int}} with no default, so it is 0 when 
> not set. {{ArangoDbEndpoint.doStart()}} checks 
> {{ObjectHelper.isNotEmpty(configuration.getPort())}}, which is true for 0, 
> and calls {{builder.host(host, 0)}}. The user sees a connection failure on 
> the first message instead of a clear error at startup.
> Proposed change: fail at startup when host is set without port, or default 
> the port to 8529, the default port of ArangoDB.
> h4. 3. getServiceUrl() returns null:0 when a client is set
> {{ArangoDbEndpoint.getServiceUrl()}} returns {{configuration.getHost() + ":" 
> + configuration.getPort()}}. With an {{arangoDB}} client and no host option, 
> which is the usual setup, it returns {{null:0}}, which then shows up as the 
> service location of the endpoint (for example in the dev console).
> Proposed change: return null when host is not set, or take the host from the 
> client.
> h4. 4. The database path parameter field of ArangoDbEndpoint is never assigned
> {{ArangoDbEndpoint.database}} carries the {{@UriPath}} but has no setter and 
> is never set. {{ArangoDbComponent.createEndpoint()}} puts the path into 
> {{ArangoDbConfiguration.database}}, which is what the producer reads. The 
> field is dead code that only holds the metadata.
> Proposed change: move the {{@UriPath}} to {{ArangoDbConfiguration.database}} 
> and remove the endpoint field, or set the field as well.
> h4. 5. host and port are not marked as required
> Without an {{arangoDB}} client, the endpoint does not start unless host and 
> port are set: {{ArangoDB.Builder.build()}} of driver 7.28.0 throws "No host 
> has been set!". The metadata does not mark them as required, and they cannot 
> be marked so simply because an {{arangoDB}} client replaces them.
> Proposed change: check in {{ArangoDbEndpoint.doStart()}} that host and port, 
> or an {{arangoDB}} client, are set, and fail with an error message that names 
> the options.
> _Claude Code on behalf of davsclaus_



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to