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

   # Description
   
   [CAMEL-27600](https://issues.apache.org/jira/browse/CAMEL-27600)
   
   The ticket lists three problems of camel-azure-iothub found while the option 
descriptions were written for CAMEL-23832 (#30943). I checked each one against 
main and iot-device-client 2.5.1. All three are real and fixed here.
   
   1. **protocol=HTTPS failed every send, also telemetry.** When it creates a 
device client, the pool always subscribed to desired properties, and the SDK 
rejects every twin operation over HTTPS with `UnsupportedOperationException`, 
so the client creation failed and nothing was sent. The pool now subscribes 
only when the protocol is not HTTPS. TWIN and BOTH over HTTPS now fail with an 
`IllegalArgumentException` that names the protocols that support twin 
operations, before a device client is opened.
   2. **The content encoding of telemetry was always UTF-8.** A new 
`contentEncoding` option sets it. The default is UTF-8, so nothing changes 
unless the option is set. An empty value sends the message without a content 
encoding, for a binary body such as Avro or Protobuf.
   3. **sendTimeout did not cover creating the device client.** The 
subscription to desired properties now uses the SDK overload with a timeout, 
set to `sendTimeout`. `DeviceClient.open` has no timeout in the SDK, so opening 
the client still uses the SDK retry policy, and the `sendTimeout` description 
now says so. To get the timeout to the pool, `DeviceClientPool.acquire`/`lease` 
and `IoTHubSendOperations` have overloads that take it. The old signatures keep 
the SDK default.
   
   The component is new in 4.24, so I did not add an upgrade guide entry.
   
   This touches the same option descriptions and generated files as #30943. 
Whichever is merged second needs a small rebase. The `contentType` description 
in #30943 says that the producer always sets the content encoding to UTF-8, 
which becomes the default of the new option.
   
   Tests (new `IoTHubProducerProtocolOptionsTest`, with a mocked `DeviceClient` 
that throws on the desired-properties subscription over HTTPS, as the SDK does):
   - telemetry is sent over HTTPS
   - TWIN over HTTPS fails with the clear message and opens no client
   - `sendTimeout=3s` is passed to the subscription (3000 ms)
   - `contentEncoding` is UTF-8 by default, can be changed, and an empty value 
sends none
   
   Against the main sources 5 of the 6 fail ("DeviceClient creation failed", 
`RuntimeException` instead of `IllegalArgumentException`, the subscription 
without a timeout, unknown option `contentEncoding`). The UTF-8 default test 
passes on main too, as intended.
   
   Results (offline, module build of camel-azure-iothub, test phase): 48 unit 
tests run, 0 failures, 0 errors. The new test class passes 5 runs in a row.
   
   Generated files: `azure-iothub.json` of the component and its catalog copy, 
the component and endpoint configurers, the endpoint URI factory, 
`IoTHubEndpointBuilderFactory` and `AzureIothubComponentBuilderFactory`.
   
   Note for #30943 (CAMEL-23832 descriptions): its `sendTimeout` sentence 
becomes incomplete with this change, as the client open now uses it too.
   
   Known limitation, for a follow-up: the device client pool key does not 
include the protocol. If an HTTPS endpoint creates the pooled client first, an 
MQTT endpoint for the same device that uses twin operations reuses it and its 
twin call fails. Before this change HTTPS clients were never created, so this 
setup could not happen.
   
   # 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-27600](https://issues.apache.org/jira/browse/CAMEL-27600).
   
   # 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-iothub and ran its unit tests, and committed its 
regenerated files. The catalog copy and the component and endpoint DSL were 
regenerated from that JSON with the camel-package-maven-plugin DSL goals. 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