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

   # Description
   
   Part of [CAMEL-23832](https://issues.apache.org/jira/browse/CAMEL-23832). 
This pull request covers `camel-alibaba-ots` (scheme `alibaba-ots`). It does 
not complete the ticket, so please keep the ticket open.
   
   This is the first of the eight Alibaba components (alibaba-eventbridge, 
alibaba-fc, alibaba-kms, alibaba-mns, alibaba-oss, alibaba-ots, alibaba-sls and 
alibaba-sms). The pull requests of the other seven will reuse the texts of the 
shared options (`operation`, `accessKey`, `secretKey`, `serviceKeys` and the 
client option, `otsClient` here), adjusted where their code differs.
   
   Only description texts change: 7 endpoint options and 2 headers. No option 
or header is added, removed or renamed, and no default value, label, type or 
enum value changes. The component description stays as it is.
   
   The new texts are in the `description` attribute of the annotations 
(`@UriPath` and `@UriParam` on the endpoint options, `@Metadata` on the header 
constants). The old texts were already in that attribute and no setter had 
Javadoc, so no Javadoc is removed.
   
   The names were checked against the Alibaba Cloud Tablestore SDK for Java 
5.17.14 sources (`com.aliyun.openservices:tablestore`), the version set by 
`aliyun-tablestore-version` in `parent/pom.xml`.
   
   | Text | Problem in the current text | Checked against |
   |---|---|---|
   | `operation` (endpoint path option) | It does not say that the 
CamelAlibabaOtsOperation header, and after it an exchange property of the same 
name, replace the option. | `AlibabaOtsComponent.createEndpoint` (the path of 
the endpoint URI), `AlibabaOtsProducer.process`, 
`AlibabaOtsUtils.createClientConfigurations`, camel-alibaba-common 
`OpenApiClientSupport.resolveString` (the header, else the exchange property of 
the same name, else the option), `AlibabaOtsHeaders` and `AlibabaOtsProperties` 
(the name CamelAlibabaOtsOperation); no test sets the header or the exchange 
property, so this rests on reading the code |
   | `endpoint` (endpoint option) | It does not say that the Tablestore SDK 
accepts only a URL that starts with http:// or https://, nor that the option is 
not used when otsClient is set or autowired. | `AlibabaOtsUtils.createClient` 
(the only code that reads the option), `AlibabaOtsEndpoint.initClient`, 
`DefaultEndpoint.doInit` with the generated `AlibabaOtsEndpointConfigurer` (a 
single `SyncClient` in the registry is autowired into otsClient); Tablestore 
SDK `SyncClient` and `InternalClient` (an empty endpoint, or one without 
http:// or https://, fails); the endpoint on the doc page and in 
`testconfiguration.properties`; the Tablestore documentation of the instance 
endpoint (https://instanceName.RegionID.ots.aliyuncs.com) |
   | `instanceName` (endpoint option) | It does not say that the option is not 
used when otsClient is set or autowired. | `AlibabaOtsUtils.createClient` (the 
only code that reads the option), `AlibabaOtsEndpoint.initClient`, 
`DefaultEndpoint.doInit` (as `endpoint`); Tablestore SDK `SyncClient`, 
`InternalClient` |
   | `accessKey` (endpoint option) | It does not use the Alibaba Cloud term 
AccessKey ID, and it does not say how the option relates to serviceKeys and 
otsClient. | `AlibabaOtsUtils.createClient`, camel-alibaba-common 
`OpenApiClientSupport.resolveAccessKey` (the option, else the accessKey of 
serviceKeys, else an IllegalArgumentException), 
`AlibabaOtsEndpoint.initClient`, `DefaultEndpoint.doInit`; Tablestore SDK 
`SyncClient` (accessKeyId), `V2SignatureMaker`, `DefaultCredentialProvider`; 
the RAM documentation of the AccessKey pair |
   | `secretKey` (endpoint option) | It does not use the Alibaba Cloud term 
AccessKey secret, and it does not say how the option relates to serviceKeys and 
otsClient. | `AlibabaOtsUtils.createClient`, 
`OpenApiClientSupport.resolveSecretKey` (as `accessKey`), 
`AlibabaOtsEndpoint.initClient`, `DefaultEndpoint.doInit`; Tablestore SDK 
`SyncClient` (accessKeySecret), `V2SignatureMaker` (the AccessKey secret signs 
the request); the RAM documentation of the AccessKey pair |
   | `serviceKeys` (endpoint option) | It does not say what the object holds, 
nor when its values are used. | camel-alibaba-common `ServiceKeys` (the 
properties accessKey and secretKey), `OpenApiClientSupport.resolveAccessKey` 
and `resolveSecretKey` (each key falls back to serviceKeys on its own), 
`AlibabaOtsUtils.createClient`, `AlibabaOtsEndpoint.initClient`, 
`DefaultEndpoint.doInit` |
   | `otsClient` (endpoint option) | It does not say what the option replaces, 
nor who creates and shuts down the client. | `AlibabaOtsEndpoint` 
(`initClient`, `setOtsClient` and its flag, `doStop`, which shuts down only a 
client that the endpoint created), `AlibabaOtsProducer.process` (`initClient` 
for each exchange), the generated `AlibabaOtsEndpointConfigurer` 
(`getAutowiredNames`), `DefaultEndpoint.doInit` (autowiring); Tablestore SDK 
`SyncClient.shutdown`; `AlibabaOtsEndpointTest` (`initClient` and `doStop`), 
`AlibabaOtsProducerTest` (`initClient` for each exchange) and the tests of the 
five operations, which set otsClient |
   | `CamelAlibabaOtsOperation` (header) | It does not say what is overridden. 
| as `operation`: `AlibabaOtsProducer.process`, 
`AlibabaOtsUtils.createClientConfigurations`, 
`OpenApiClientSupport.resolveString`; no test sets the header |
   | `CamelAlibabaOtsRequestId` (header) | It does not say who sets the header, 
nor when. | `AlibabaOtsProducer` (each operation calls `setResponseHeaders` 
after the call to the `SyncClient` has returned, and sets only a request ID 
that is not empty; a failed call throws before that); Tablestore SDK 
`Response.getRequestId`, `Constants` (the response header x-ots-requestid), 
`ProtocolBufferParser` (a response without that header fails); no test checks 
the header |
   
   ## Found in the review, not changed here
   
   - `endpoint` and `instanceName` have `@Metadata(required = true)`, although 
the code reads them only when it creates the client, so they are not used when 
`otsClient` is set or autowired. Catalog validation reports them as missing all 
the same.
   - `AlibabaOtsProperties` has `@Metadata` with its own texts for the two 
header names (Operation to perform, Request id returned by Tablestore). The 
build reads only the headers class `AlibabaOtsHeaders` and its supertypes, so 
these texts are not used. This pull request does not change them.
   - `AlibabaOtsEndpoint.initClient` is not synchronized and the field is not 
volatile, and the producer calls it for each message, so two messages that are 
processed at the same time, before a client exists, can each create a 
`SyncClient`. The endpoint keeps only the last one, and the other is never shut 
down (found by reading the code).
   - A client creation that fails leaves the field null, so it is tried again 
for each message. When the SDK rejects the endpoint (no http:// or https://) or 
the instance name, each attempt leaks SDK threads, because the `SyncClient` 
constructor starts its HTTP client and a connection evictor before these 
checks, and nothing shuts them 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).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] I have run `mvn clean install -Dquickly -DskipTests` from the root 
folder and then `mvn install -DskipTests -nsu` in 
`components/camel-alibaba/camel-alibaba-ots`, `catalog/camel-catalog` and 
`dsl/camel-endpointdsl`, and I have committed all auto-generated changes.
   
   # 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.
   
   The descriptions and this text were drafted with Claude (Anthropic) and 
checked against the Camel source and the Tablestore SDK for Java 5.17.14 
sources.
   
   _Claude Code on behalf of saravanakumar1987_
   
   🤖 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