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

Claus Ibsen resolved CAMEL-27600.
---------------------------------
    Resolution: Fixed

> camel-azure-iothub: HTTPS always fails, fixed UTF-8 encoding, client open 
> ignores sendTimeout
> ---------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-27600
>                 URL: https://issues.apache.org/jira/browse/CAMEL-27600
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-azure
>            Reporter: Claus Ibsen
>            Assignee: shashank
>            Priority: Minor
>             Fix For: 4.25.0
>
>
> Found while improving the option descriptions of camel-azure-iothub for 
> CAMEL-23832 (PR https://github.com/apache/camel/pull/30943).
> These are separate problems of the component; the descriptions PR only 
> documents the current behavior.
> h4. 1. protocol=HTTPS fails for every send, also for TELEMETRY
> {{DeviceClientPool.createClient()}} opens the client and then always calls 
> {{client.subscribeToDesiredProperties(...)}}. In iot-device-client 2.5.1, 
> {{InternalClient.subscribeToDesiredPropertiesAsync()}} calls 
> {{verifyTwinOperationsAreSupported()}}, which throws 
> {{UnsupportedOperationException}} ("Twin operations are only supported over 
> MQTT, MQTT_WS, AMQPS, and AMQPS_WS") for HTTPS.
> {{createClient()}} closes the client and throws 
> {{RuntimeException("DeviceClient creation failed for device: ...")}}. So with 
> {{protocol=HTTPS}} no message is ever sent, even with 
> {{deliveryMode=TELEMETRY}}, although the {{protocol}} enum offers HTTPS.
> Proposed change: subscribe to desired properties only when the protocol 
> supports twin operations (or drop the subscription, as the callback does 
> nothing), and fail TWIN and BOTH over HTTPS with a clear message.
> h4. 2. The content encoding of telemetry is always UTF-8
> {{TelemetryDeliveryStrategy.execute()}} always calls 
> {{msg.setContentEncoding("UTF-8")}}. The body is sent as {{byte[]}}, so a 
> binary body (for example Avro or protobuf) is labeled as UTF-8 text. IoT Hub 
> message routing then tries to parse the body for a query on it. No option 
> changes the encoding.
> Proposed change: add a {{contentEncoding}} option (default UTF-8, to keep the 
> current behavior) that can be set to empty to not set the encoding.
> h4. 3. sendTimeout does not cover opening the device client
> {{DeviceClientPool.createClient()}} calls {{client.open(true)}} and 
> {{client.subscribeToDesiredProperties(callback, null)}} without a timeout, so 
> they use the SDK defaults. Only {{sendEvent()}}, {{getTwin()}} and 
> {{updateReportedProperties()}} get {{sendTimeout}}. The first message for a 
> device can therefore block far longer than {{sendTimeout}} when the hub is 
> slow or not reachable.
> Proposed change: pass {{sendTimeout}} to the subscription call (the SDK has 
> an overload with a timeout), and document that opening the client uses the 
> SDK retry policy, or add a separate open timeout.
> _Claude Code on behalf of davsclaus_



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

Reply via email to