MQTT Client V5 Implementation (4.x branch) - #269
Open
dometec wants to merge 9 commits into
Open
Conversation
dometec
force-pushed
the
client_mqtt5_vertx4
branch
2 times, most recently
from
May 7, 2026 21:22
805eeec to
4eb4fe1
Compare
dometec
marked this pull request as ready for review
May 12, 2026 07:11
ozangunalp
suggested changes
May 19, 2026
ozangunalp
left a comment
Contributor
There was a problem hiding this comment.
@dometec I've pointed out some flagrant things I saw about correctness.
|
|
||
| @Override | ||
| public synchronized void pause() { | ||
| connOption.setAutoRead(false); |
Contributor
There was a problem hiding this comment.
what if the ChannelConfig connOption is not yet set ? Shall we accept pause/resume after we receive ConnAck ?
Contributor
Author
There was a problem hiding this comment.
connOption is set at connection time (as connection), moreover that pause is called for sure after the client get some messages
| private String[] pickServer(String serverReference) { | ||
| if (serverReference == null || serverReference.trim().isEmpty()) return null; | ||
| String[] entries = serverReference.split(","); | ||
| String entry = entries[ThreadLocalRandom.current().nextInt(entries.length)].trim(); |
Contributor
There was a problem hiding this comment.
@vietj would you have any guidance to avoid the usage of ThreadLocalRandom ?
Contributor
|
@dometec would you have time to also open the PR targeting Vert.x 5 (master) ? |
dometec
force-pushed
the
client_mqtt5_vertx4
branch
from
June 27, 2026 14:02
7886c4f to
4203f8d
Compare
dometec
force-pushed
the
client_mqtt5_vertx4
branch
from
July 14, 2026 16:33
371e0c5 to
9fad186
Compare
Port of upstream commit b7c3bd8 from client_mqtt5_master onto the vertx4 branch. Functional scope unchanged from the original commit: - Manage Publish v5 - Updated MqttEndpointImpl to handle PUBCOMP messages with reason codes. - Enhance authentication and subscription features - Modified MqttServerConnection to allow AUTH messages before CONNACK. - Added support for Wildcard and Shared Subscription properties in MqttConnAckMessage. - Implemented corresponding methods in MqttConnAckMessageImpl to retrieve new properties. - Added tests in Mqtt5ClientConnectTest for user properties in CONNECT packets. - Enhanced Mqtt5ClientDisconnectTest to verify server-initiated DISCONNECT handling. - Updated Mqtt5ClientPublishTest to check for maximum packet size enforcement. - Added tests in Mqtt5ClientSubscribeTest for handling of wildcard and shared subscriptions. - Created Mqtt5ClientWillTest to ensure correct encoding of will message properties. - Manage Server Redirect - Manage Subscription Identifier - Manage TopicAlias from Broker to Client Breaking Changes: - Removed willFlag client side (info derived from the presence of willTopic and willPayload). - Will options serialized as object in json. Adaptations for vertx4 / older Netty: - Coexistence of legacy Handler<AsyncResult<>> overloads with the new Future-based v5 API (connect, disconnect, publish, unsubscribe). - MqttProperties.<NAME> rewritten to MqttProperties.MqttPropertyType.<NAME>.value() because Netty 4.1.133 exposes property ids only via the enum. - String.isBlank() replaced with trim().isEmpty() (Java 8 compatibility). - List.of(...) / Map.of(...) replaced with Arrays.asList / Collections.singletonMap in tests. - connect(...) calls disambiguated with explicit (Map<String,String>) null casts. - Imported io.vertx.core.net.* to keep JksOptions / PfxOptions / PemKeyCertOptions / PemTrustOptions visible. - Pulled MqttAuthenticationExchangeMessage / MqttAuthenticateReasonCode / MqttAuthenticationExchangeMessageImpl from master as transitive dependencies. Server-side AUTH feature is incomplete: only a stub handleAuth was added to MqttEndpointImpl, and Mqtt5ClientAuthTest was dropped. The full authentication-exchange API requires upstream commit 892e923, which is not part of this port. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Mqtt5ServerRedirectTest: replace Future.compose() chain in @after with nested callback-style closes. Under Vert.x 4 the compose chain hits a RejectedExecutionException ("event executor terminated") because the intermediate future is dispatched onto a context that vertx.close() has already torn down, leaving the test framework hanging until the 120s outer timeout. Also replace Future.all (Vert.x 5) with CompositeFuture.all. - Mqtt5ClientFlowControlTest: same Future.all -> CompositeFuture.all substitution; List<Future<?>> tightened to List<Future> to match the Vert.x 4 CompositeFuture.all(List<Future>) overload. The redirect logic in MqttClientImpl was already correct; the failures were purely a test-side incompatibility with the Vert.x 4 future API. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…n current instance and add validation for QoS
…mpl, and add corresponding tests
…ication exchange during connecting state
…t-side authentication flow and provide example for SCRAM-SHA-256
…efactor; not on vertx4) Ports the portable subset of the last 4 commits on client_mqtt5_master: - f3820d7: README now states the client is compliant with both 3.1.1 and 5.0 - f6dd00f: drop unused imports (MqttConnAckMessage, java.util.Map, MqttServerOptions) in the touched MQTT 5 test classes 269067a is already satisfied/N-A on vertx4 (no publish(int id,..) family, no example10, @GenIgnore import and 2-arg authenticationExchange doc already present). d96cad9 is skipped: it relies on the server-side MqttEndpoint.authenticationExchange, which vertx4 does not have. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dometec
force-pushed
the
client_mqtt5_vertx4
branch
from
July 27, 2026 22:19
9fad186 to
57e2b5a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a backport of #265 to the 4.x branch.
The tests I’ve run so far are OK, but I’m leaving this as a draft (like #265) because I want to run additional.