thst71 opened a new pull request, #27104: URL: https://github.com/apache/camel/pull/27104
# Description This PR adds MQTT 3.1.1 support to the existing `camel-hivemq` component via a new `mqttVersion` option (`MQTT_5_0`, the default, or `MQTT_3_1_1`), instead of introducing a separate component. This replaces #26899, which took the separate-component route (`camel-hivemq311`). Following the discussion there (@oscerd, @Croway), this PR takes the alternative approach instead: the `mqttVersion` option on `camel-hivemq` that was originally suggested. The HiveMQ MQTT Client library exposes MQTT 3.1.1 and MQTT 5 as two structurally separate client APIs (`Mqtt3AsyncClient`/`Mqtt3*` vs `Mqtt5AsyncClient`/`Mqtt5*`) with no common publish/subscribe interface, so `HiveMQEndpoint`/`HiveMQConsumer`/`HiveMQProducer` were previously hard-wired to the MQTT 5 types. This introduces a small internal `HiveMQClientAdapter` interface with one implementation per protocol version (`Mqtt3ClientAdapter`, `Mqtt5ClientAdapter`), so the endpoint/consumer/producer only depend on a protocol-neutral adapter and don't need to know which version is in use. Since the abstraction necessarily hides which concrete client type is active, `HiveMQClientAdapter.getClient(Class<T>)` gives callers who need functionality this component doesn't cover direct, type-safe access to the real underlying client object (`Mqtt5AsyncClient` or `Mqtt3AsyncClient`), exposed publicly via a same-named method on `HiveMQConsumer`/`HiveMQProducer`. This addresses the concern raised on #26899 that an abstraction would cost callers direct access to the native client. # 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). Tracked by [CAMEL-25030](https://issues.apache.org/jira/browse/CAMEL-25030) (same ticket as #26899). # 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 -DskipTests` locally from root folder 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. This is an AI-assisted contribution: implemented together with Claude Sonnet 5 (Anthropic) on behalf of @thst71. All commits carry `Co-authored-by: Claude Sonnet 5 <[email protected]>` trailers. -- 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]
