docs: publish the mqtt service docs and extend details on the different options#4144
docs: publish the mqtt service docs and extend details on the different options#4144reubenmiller wants to merge 4 commits intothin-edge:mainfrom
Conversation
…nt options Signed-off-by: reubenmiller <reuben.d.miller@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
| and a second bridge is set up specifically to connect to the MQTT service endpoint. | ||
| This uses the community package [`tedge-mapper-c8y-mqttservice`](https://github.com/thin-edge/tedge-mapper-c8y-mqttservice). | ||
|
|
||
| 1. Make sure the device is already connected to Cumulocity. If not, follow the [connection guide](./connect.md). |
There was a problem hiding this comment.
The connection itself isn't really necessary, right? Only the c8y.url config needs to be set, no?
There was a problem hiding this comment.
That is more to prove that the device is already connected and functioning correctly with the given certificates.
| ```sh | ||
| sudo systemctl start tedge-mapper-c8y-mqttservice | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Should we add a WARN/CAUTION here, advising the user to never publish a SmartREST message over this connection, as it can put the bridge connection in a permanent infinite loop.
There was a problem hiding this comment.
Would it though?
There was a problem hiding this comment.
Which bridge will be stuck in a loop? Why?
There was a problem hiding this comment.
The MQTT service bridge would be stuck in the infinite loop as follows(for the logs of the tedge-mapper-c8y-mqttservice service):
Apr 24 11:28:07 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:28:07.583248332Z INFO MQTT: Connection established
Apr 24 11:28:08 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:28:08.343202171Z INFO MQTT bridge: [cloud] Received CONNACK (Connection Acknowledged): ConnAck { session_present: false, code: Success }
Apr 24 11:28:08 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:28:08.343285773Z INFO MQTT bridge: [cloud] MQTT bridge connected to cloud broker
Apr 24 11:28:08 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:28:08.34330484Z INFO MQTT bridge: [cloud] Bridge connection subscribing to []
<----- I published the message to s/us topic here
Apr 24 11:29:54 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:29:54.682898358Z WARN MQTT bridge: [cloud] Connection error: MqttState(ConnectionAborted)
Apr 24 11:29:54 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:29:54.683103276Z ERROR MQTT bridge: [cloud] MQTT bridge failed to connect to cloud broker: Mqtt state: Connection closed by peer abruptly
Apr 24 11:29:54 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:29:54.6831947Z INFO MQTT bridge: [cloud] Waiting 3.424393831s until attempting reconnection to broker
Apr 24 11:29:58 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:29:58.109170648Z INFO MQTT bridge: [cloud] Attempting to connect to broker
Apr 24 11:29:58 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:29:58.735043371Z INFO MQTT bridge: [cloud] Received CONNACK (Connection Acknowledged): ConnAck { session_present: false, code: Success }
Apr 24 11:29:58 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:29:58.735076616Z INFO MQTT bridge: [cloud] MQTT bridge connected to cloud broker
Apr 24 11:29:58 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:29:58.735103855Z INFO MQTT bridge: [cloud] Bridge connection subscribing to []
Apr 24 11:29:58 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:29:58.73620737Z WARN MQTT bridge: [cloud] Ignoring already known pkid=1
Apr 24 11:29:58 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:29:58.936942781Z WARN MQTT bridge: [cloud] Connection error: MqttState(ConnectionAborted)
Apr 24 11:29:58 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:29:58.937146792Z ERROR MQTT bridge: [cloud] MQTT bridge failed to connect to cloud broker: Mqtt state: Connection closed by peer abruptly
Apr 24 11:29:58 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:29:58.937198685Z INFO MQTT bridge: [cloud] Waiting 5.243963079s until attempting reconnection to broker
Apr 24 11:30:04 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:30:04.183089951Z INFO MQTT bridge: [cloud] Attempting to connect to broker
Apr 24 11:30:04 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:30:04.696777396Z INFO MQTT bridge: [cloud] Received CONNACK (Connection Acknowledged): ConnAck { session_present: false, code: Success }
Apr 24 11:30:04 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:30:04.696885513Z INFO MQTT bridge: [cloud] MQTT bridge connected to cloud broker
Apr 24 11:30:04 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:30:04.696929374Z INFO MQTT bridge: [cloud] Bridge connection subscribing to []
Apr 24 11:30:04 57e6f37c9cf3 tedge-mapper[939]: 2026-04-24T11:30:04.698330978Z WARN MQTT bridge: [cloud] Ignoring already known pkid=1
There was a problem hiding this comment.
@albinsuresh Can you just confirm what message you actually published.
There was a problem hiding this comment.
Ah by "infinite loop" you're talking about that the mqtt client is being disconnected because it publishing to a forbidden topic...not that we have a message loop.
There was a problem hiding this comment.
Added a warning 2f041a7
Though we should probably add a feature in the MQTT Service mapper which will reject/discard those messages if a specific setting is enabled, so that we can prevent user-pain here.
| Use [go-c8y-cli](https://github.com/reubenmiller/go-c8y-cli) to enable the required tenant feature, or you can use the Cumulocity Administration application: | ||
|
|
||
| ```sh | ||
| c8y features enable --key mqtt-service.smartrest |
There was a problem hiding this comment.
It'd be good to provide the alternative curl command using the REST API for the same as well, for those not using go-c8y-cli.
There was a problem hiding this comment.
Curl becomes even more confusing for users as you need to talk about authorization etc. I'd stick to go-c8y-cli, or people can use the features UI
There was a problem hiding this comment.
go-c8y-cli is with no doubts the perfect companion to thin-edge in a Cumulocity context. It make sense to encourage our users to use it.
|
|
||
| 1. Make sure the device is already connected to Cumulocity. If not, follow the [connection guide](./connect.md). | ||
|
|
||
| 1. Install the `tedge-mapper-c8y-mqttservice` community package |
There was a problem hiding this comment.
How about adding one step prior to this one, with the instruction to setup the community repo as well? Even though the Set Me Up button is there at the top of the community repo, I'm not quite sure if people would always notice it. Also wondering if we should add these installation instructions to the README of the community plugin as well.
There was a problem hiding this comment.
the docs could benefit from that, but I'd leave that off the README in the repo, as if you click on the link to the package, it will redirect you so the cloudsmith page showing the package and the "setup me up" button.
| To display the full set of topic mapping rules for the Cumulocity bridge, run: | ||
|
|
||
| ```sh | ||
| tedge bridge inspect c8y |
There was a problem hiding this comment.
That command would be different based on how we connected, right? It could be tedge bridge inspect c8y-mqttservice as well, if Option 1 was followed.
There was a problem hiding this comment.
Opps, that should read tedge bridge inspect c8y-mqttservice
There was a problem hiding this comment.
Actually it needs both depending on which option the user used...
There was a problem hiding this comment.
There are now tabs which present the commands based on each option. Resolved in b669a4b
| Once installed, the package reads the existing %%te%% Cumulocity configuration (e.g. `c8y.url` and device | ||
| certificate) and automatically configures the second bridge to connect to the same tenant. |
There was a problem hiding this comment.
For those users that have not already connected to the core MQTT endpoint, or not even planning to, would it make sense to capture setting the url in the mapper.toml as a standalone step?
There was a problem hiding this comment.
That is highlighted in the next step
There was a problem hiding this comment.
But maybe a word saying "if it already configured" somewhere in the sentence would help clarify it
| endpoint, which restricts devices to a predefined set of topics and data formats (e.g. SmartREST and JSON over MQTT). | ||
| The [Cumulocity MQTT service](https://cumulocity.com/docs/device-integration/mqtt-service) on the other hand, | ||
| is the next-gen MQTT endpoint offered by Cumulocity, | ||
| which allows devices to publish and receive data using user-defined custom topic and payload formats as well. |
There was a problem hiding this comment.
I would add a note here telling that the MQTT service will soon provide the two aspects (legacy API + extensible endpoints). This would make clearer the table below - with 3 variants.
There was a problem hiding this comment.
Added a sentence about it the future of having 1 endpoint capable of both free-form and SmartREST based topics. b669a4b
| |----|----|-----------|------| | ||
| |Core MQTT|8883|Allows devices to send messages directly into Cumulocity, provided that the device implements the pre-defined topic schema and payload formats of Core MQTT|[General Availability](https://cumulocity.com/docs/2024/glossary/g/#ga)| | ||
| |MQTT Service|9883|Allows devices to send and receive arbitrary payloads on any MQTT topic|[Public Preview](https://cumulocity.com/docs/2024/glossary/p/#public-preview) (subject to change)| | ||
| For more information about the two MQTT interfaces offered by Cumulocity, see the following table. |
There was a problem hiding this comment.
The with or without SmartREST support should not come as a surprise reading the table.
So beyond the number of options, we need to say first a word about SmartREST support.
| For more information about the two MQTT interfaces offered by Cumulocity, see the following table. | |
| For more information about the three MQTT interfaces offered by Cumulocity, see the following table. |
There was a problem hiding this comment.
Added a sentence about it, and I just avoided being explicit how many options are available. b669a4b
| ``` | ||
|
|
||
| 1. Provide the topics to subscribe to (e.g: topic to receive sensor config updates) | ||
| You can set multiple topics by using comma separated values. |
There was a problem hiding this comment.
Another way is to use tedge config add
$sudo tedge config add c8y.mqtt_service.topics hello/c8y
There was a problem hiding this comment.
In addition, the difference of the examples above and below tedge config set c8y.mqtt_service.topics is the only using " or not. Both are using comma-separated values. I agree to replace one example with tedge config add.
There was a problem hiding this comment.
Added an additional example of using add in b669a4b
There was a problem hiding this comment.
And I accidentally introduced a duplicate section...but I've removed the csv info and replaced it with the add command, a1439fe
…different options Signed-off-by: reubenmiller <reuben.d.miller@gmail.com>
…on the different options Signed-off-by: reubenmiller <reuben.d.miller@gmail.com>
…etails on the different options Signed-off-by: reubenmiller <reuben.d.miller@gmail.com>
Proposed changes
Publish the previously unlisted Cumulocity MQTT Service page, and include the two different options (e.g. dual bridge connections, or using a single connection).
Types of changes
Paste Link to the issue
Checklist
just prepare-devonce)just formatas mentioned in CODING_GUIDELINESjust checkas mentioned in CODING_GUIDELINESFurther comments