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

   # Description
   
   [CAMEL-27618](https://issues.apache.org/jira/browse/CAMEL-27618)
   
   The ticket lists eight problems of camel-azure-cosmosdb that came up while 
the option descriptions were written for CAMEL-23832 (#30956). I checked each 
one against main. All eight are fixed here, the first one only in part: the 
rest of it would break routes that work today.
   
   Fixed:
   1. **A PartitionKey header did not work.** The partition key is read as a 
String, so a `com.azure.cosmos.models.PartitionKey` in the 
`CamelAzureCosmosDbItemPartitionKey` header was converted with `toString()`, 
which is the JSON of the key (`["5"]`), and that text became the partition key 
value. Such a header is now used as it is. This also gives a way to address an 
item whose partition key value is a number or a boolean.
   2. **clientTelemetryEnabled has no effect.** In azure-cosmos 4.75.0 
`CosmosClientBuilder.clientTelemetryEnabled(boolean)` only returns the builder 
(checked with javap). The option is deprecated, with a deprecation note.
   3. **The headers were not in the component metadata.** The constants of 
`CosmosDbConstants` now have `@Metadata` (description, javaType, label 
`producer`), and `@UriEndpoint` has `headersClass`, so the headers are listed 
in the catalog, in the Endpoint DSL (`CosmosDbHeaderNameBuilder`) and in the 
generated header table of the doc page. The two hand-written tables are 
removed. Writing the metadata turned up two more gaps in those tables: 
`CamelAzureCosmosDbIndexingPolicy` was missing, and 
`CamelAzureCosmosDbTimestamp` is an `Instant`, not a `String`.
   4. **CamelAzureCosmosDbRecourseId was misspelled.** It is now 
`CamelAzureCosmosDbResourceId`. I followed `design/headers.adoc`, which asks 
for a plain rename with an upgrade guide entry and no alias, rather than 
setting both names for one release.
   5. **databaseEndpoint was marked required.** `CosmosDbComponent` only 
requires it when `cosmosAsyncClient` is not set, and checks that itself, so 
`required` is dropped.
   6. **The default of consistencyLevel did not match its enum values.** The 
default is now `Session`, the spelling of the enum values in the metadata. Both 
spellings convert to `ConsistencyLevel.SESSION`, so nothing changes at runtime.
   7. **indexingPolicy had the label common.** Only the producer uses it (the 
consumer never calls `withIndexingPolicy()`). The label is now 
`producer,advanced`. The old label also had a space after the comma, which gave 
the option the group ` advanced`; it is now `producer (advanced)`.
   8. **The doc page asked for an Azure Storage account.** It now asks for an 
Azure Cosmos DB account.
   
   Not changed:
   - Point 1 also proposes to fail when no partition key is set, and to keep a 
number or boolean header value as it is. Today an unset partition key is the 
JSON null partition key value, which is how a route reads or writes an item 
whose partition key is null, and #30956 documents it that way ("If not set, the 
partition key value is null"). An Integer header such as 5 addresses the String 
key "5" today, and a route may rely on that. Both stay as they are; a route 
that needs a number, a boolean or an explicit null sets a `PartitionKey` header.
   
   The 4.24 upgrade guide has one entry for the header rename, with the other 
user-visible changes as a list: the PartitionKey header, the deprecated 
`clientTelemetryEnabled`, and `indexingPolicy` moving to the producer builders 
of the Endpoint DSL.
   
   This touches the same lines as #30956 (the `@UriParam` of 
`consistencyLevel`, `indexingPolicy`, `clientTelemetryEnabled` and 
`databaseEndpoint`, the doc page and the generated files), so whichever is 
merged second needs a small rebase. Text of #30956 that this changes: its 
`consistencyLevel` keeps `defaultValue = "SESSION"`, and its `indexingPolicy` 
keeps the label `common, advanced`. The doc page of #30956 still has the 
hand-written header tables with `CamelAzureCosmosDbRecourseId`, and its 
"Prerequisites" still ask for an Azure Storage account.
   
   Tests (new, unit test, no Cosmos DB needed):
   - `CosmosDbItemPartitionKeyTest`: a `PartitionKey` header with a number, a 
boolean and a String is used as it is; a String header, an Integer header and 
the `itemPartitionKey` option still give a String partition key value. Against 
the main sources the first test fails (the key is `["[5.0]"]`, the JSON text of 
`PartitionKey(5)` taken as a String); the second one passes, as it should.
   
   Results (offline, module build of camel-azure-cosmosdb, test phase): 61 
tests run, 0 failures, 0 errors. The new test passes 5 runs in a row.
   
   Generated files: `azure-cosmosdb.json` of the component and its catalog 
copy, the catalog copy of the doc page, the endpoint DSL 
(`CosmosDbEndpointBuilderFactory` with the header builder and the deprecated 
option, and `EndpointHeaderBuilders`), and the component DSL 
(`AzureCosmosdbComponentBuilderFactory`).
   
   # 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-27618](https://issues.apache.org/jira/browse/CAMEL-27618).
   
   # 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-azure-cosmosdb and ran its unit tests, and committed the 
regenerated component JSON. The catalog copies were updated to match it, and 
the endpoint and component DSL were generated from the catalog JSON with the 
camel-package goals, as an offline build of those modules was not possible 
here. 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