Implement MQTT Message Publishing in MqttManager (CATROID-1673) - #5225
Open
Paras-ydv wants to merge 1 commit into
Open
Implement MQTT Message Publishing in MqttManager (CATROID-1673)#5225Paras-ydv wants to merge 1 commit into
Paras-ydv wants to merge 1 commit into
Conversation
|
harshsomankar123-tech
requested review from
harshsomankar123-tech,
reichli and
wslany
July 5, 2026 18:22
14 tasks
- Add publish() to MqttClientInterface and PahoMqttClient - Implement publish() in MqttManager with topic validation (blank, wildcards), QoS range check (0-2), and retained flag support - Lazy-connect before publishing if no active connection exists - Rename publishFromContext() to avoid Detekt MethodOverloading - Log failures without crashing; no forced unwrap - Add comprehensive unit tests: empty payload, QoS boundaries, retained flag, lazy connect, no reconnect when already connected, no publish when connect fails (51 tests total)
Paras-ydv
force-pushed
the
CATROID-1673
branch
from
September 2, 2026 15:49
938c828 to
afa93c1
Compare
|
23 tasks
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.



Summary
Extends
MqttManagerto support publishing MQTT messages to a broker using Eclipse Paho.This PR previously carried the dependency and settings groundwork (CATROID-1670, CATROID-1672) and the connection lifecycle (CATROID-1671) as extra commits, because none of them were on
developyet. All three have since been merged (#5220, #5222), so the branch has been rebased ontodevelopand those commits removed. What remains is a single commit containing only the publish work.CATROID-1673 — Publish implementation
Changes
publish(topic, message)toMqttClientInterfaceand implemented it inPahoMqttClientMqttManager.publish()validates the topic (rejects blank, rejects the#and+wildcards, which are only legal in subscriptions) and the QoS range (0–2)publishFromContext()convenience wrapper for the brick layerfalserather than thrownconnectionLostnow passes theThrowabletoLog.eso the stacktrace is keptTests
24 new tests covering publish and message building:
#and+)falsewithout crashingbuildMessage()sets payload, QoS and retained correctlyTwo existing tests were updated in this rebase.
MqttManagernow takes anMqttClientFactoryrather than a client instance, following the change made during the CATROID-1671 review, so tests that assumed an injected client had to connect first. Without that,testPublishWhenAlreadyConnectedDoesNotReconnectfailed andtestSubscribeAfterDisconnectSucceedsAgaindid not compile.Full suite: 4709 tests, 0 failures.
Acceptance criteria
publish()API added toMqttManagerpublish()added toMqttClientInterfaceandPahoMqttClientYour Checklist