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

   # Description
   
   [CAMEL-27625](https://issues.apache.org/jira/browse/CAMEL-27625)
   
   The ticket lists five problems of camel-ibm-watson-speech-to-text that came 
up while the option descriptions were written for CAMEL-23832 (#30964). I 
checked each one against main. Four are fixed here, one is left as it is.
   
   Fixed:
   1. **The health check options did nothing.** The component extends 
`HealthCheckComponent`, but the module had no health check. The producer now 
registers `WatsonSpeechToTextProducerHealthCheck` in the producers repository 
when it starts and removes it when it stops, in the same way as the AWS 
producers. The check calls `listModels` and is DOWN when the call fails, with 
the HTTP status code as detail for an error answer of the service. Like every 
producer health check it runs only when producer health checks are enabled 
(`camel.health.producersEnabled=true`, off by default), and 
`healthCheckProducerEnabled=false` on the component leaves it out. 
`healthCheckConsumerEnabled` has no effect, as on the other producer only 
components that extend `HealthCheckComponent`.
   3. **serviceUrl had the label common.** The endpoint is producer only, so 
the option is now in the `producer` group.
   4. **The headers had no label.** All of them now have the label `producer`. 
The producer reads them, and sets `CamelIBMWatsonSTTTranscript`, 
`CamelIBMWatsonSTTModel` and `CamelIBMWatsonSTTContentType` on the result of 
`recognize`.
   5. **getCustomModel read the customization ID from 
CamelIBMWatsonSTTModelName.** The new `CamelIBMWatsonSTTCustomizationId` header 
gives the customization ID. When it is not set, `CamelIBMWatsonSTTModelName` 
and then the message body are read as before, so existing routes keep working. 
The getCustomModel example of the doc page uses the new header.
   
   Not changed:
   2. **The label path is not used.** That is true, only `getLabel()` and 
`setLabel()` touch it. #30964 documents it as a logical name that the component 
does not use. Giving it a meaning, such as a default operation, would change 
what existing endpoints do, so I left it.
   
   The health check and the new header are in the 4.24 upgrade guide, next to 
the entry of camel-ibm-watsonx-data.
   
   This touches the same lines as #30964 (`serviceUrl`, the headers in 
`WatsonSpeechToTextConstants`, and the generated files), so the two PRs will 
conflict textually and whichever is merged second needs a rebase. One 
description in #30964 becomes wrong:
   - `CamelIBMWatsonSTTModelName`: "The name of the speech model for getModel, 
or the customization ID of the custom language model for getCustomModel. If not 
set, the producer reads it from the message body." For getCustomModel the 
`CamelIBMWatsonSTTCustomizationId` header now comes first, and this header is 
read only when that one is not set.
   
   #30964 also keeps `@UriParam(label = "common", ...)` on `serviceUrl`, which 
should become `producer` on a rebase.
   
   Tests:
   - `WatsonSpeechToTextCustomModelHealthCheckTest` (new; a JDK HttpServer 
plays Speech to Text, as in `WatsonSpeechToTextAudioStreamTest`): the 
`CamelIBMWatsonSTTCustomizationId` header selects the custom model; it comes 
before `CamelIBMWatsonSTTModelName`; `CamelIBMWatsonSTTModelName` alone still 
works; the producer health check is UP while the service lists its models and 
DOWN with status code 503 when it fails. The test uses the literal header name, 
so it compiles against main too. Against the main sources 3 of the 4 fail (no 
customization ID: "Custom model ID must be specified"; the model name header is 
used instead; no producer health check of the component). The model name test 
passes on main, as that behaviour did not change.
   
   Results (offline, module build of camel-ibm-watson-speech-to-text, test 
phase, unit tests only): 18 tests run, 0 failures, 0 errors, 4 skipped (the 
skipped ones are `@EnabledOnOs(OS.LINUX)` and skip on main too on this 
machine). The new test class passed 5 runs in a row.
   
   Generated files: `ibm-watson-speech-to-text.json` of the component and its 
catalog copy, the catalog copy of the doc page, 
`WatsonSpeechToTextEndpointBuilderFactory` of the endpoint DSL and 
`IbmWatsonSpeechToTextComponentBuilderFactory` of the component DSL.
   
   # 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-27625](https://issues.apache.org/jira/browse/CAMEL-27625).
   
   # 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-ibm-watson-speech-to-text and ran its unit tests, and 
committed the regenerated component JSON. The catalog copies of the JSON and of 
the doc page are copies of them (they were identical on main), and the endpoint 
and component DSL were regenerated from it with the generate-endpoint-dsl and 
generate-component-dsl goals of camel-package-maven-plugin, 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