Skip to content

csapi-mqtt: Part 3 topic scheme (new module, 0.1.0) - #261

Merged
alexrobin merged 9 commits into
masterfrom
feature/cs-api-mqtt/250-topic-scheme
Nov 11, 2026
Merged

alexrobin merged 9 commits into
masterfrom
feature/cs-api-mqtt/250-topic-scheme

Conversation

@tipatterson-dev

@tipatterson-dev tipatterson-dev commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Adds sensorhub-service-csapi-mqtt 0.1.0, a new module with the CS API Part 3 topic scheme. The legacy module sensorhub-service-consys-mqtt does not change, so existing clients keep the legacy topics (#274).

Closes #250, closes #251, closes #252, closes #253, closes #274. Part of #249.

Changes

  • All topics start with {nodeId}/ (new config, default api). The nodeId is checked at init: one topic level, no /, +, # or NUL, no leading $. (consys-mqtt: add {nodeId} topic prefix #251)
  • Resource Data topics put :data on the last collection name and use the full {systemPath}, for example api/systems/134/subsystems/7/datastreams/12/observations:data. Only the topic templates of Part 3 are accepted. (consys-mqtt: add :data Resource Data topics #252)
  • :data/{format} selects a format. The token comes from the media type (remove parameters and application/, change + to -, lowercase). Unknown tokens are rejected, with no fallback to the default. (consys-mqtt: add :data/{format} subtopics #253)
  • TopicMapper replaces the old URL rewriting of the legacy connector.
  • New module (csapi-mqtt: move the Part 3 binding to its own module #274): package org.sensorhub.impl.service.csapi.mqtt, classes CsApiMqtt*, Admin UI name "Connected Systems API Part 3 MQTT Service". consys-mqtt is the same as on master. Both modules can run on one node: legacy topics under /api/, Part 3 topics under {nodeId}/.
  • README: setup, topics, formats, examples, status, known limits, and how to move a client from the legacy module. The README is also shown in the Admin UI.

Each sub-issue was merged into this branch with --no-ff, so the history shows one merge per sub-issue.

Migration

To move a client from the legacy module, add this module and change the client topics, for example:

  • /api/datastreams/{dsId}/observations becomes {nodeId}/systems/{sysId}/datastreams/{dsId}/observations:data
  • ...?f=application/swe+csv becomes ...:data/swe-csv

The full list and steps are in the README, under "Legacy module".

Testing

  • TestTopicMapper: nodeId rules, all Part 3 data topic templates, format tokens, and rejected topics.
  • On a test node with the embedded HiveMQ broker: subscribe and publish over MQTT 5 for observations (all formats), commands, command status, video (swe-binary), and system and datastream creation. The formats that work are listed in the README.

Stack

This is the base of a stack:

  1. This PR (consys-mqtt: Part 3 topic scheme #250)
  2. csapi-mqtt: AsyncAPI service description #263 AsyncAPI service description (consys-mqtt: publish AsyncAPI service description #256), based on this branch
  3. csapi-mqtt: Resource Events for systems, datastreams and control streams #264 Resource Events (consys-mqtt: add Resource Events #254), based on csapi-mqtt: AsyncAPI service description #263

Related: osh-core issues found during testing (for example swe+xml trailing read, unfiltered per-command status) are listed in the README as known limits. They also affect HTTP and will be filed against osh-core.

@tipatterson-dev tipatterson-dev changed the title consys-mqtt: Part 3 topic scheme (3.0.0) csapi-mqtt: Part 3 topic scheme (new module, 0.1.0) Nov 9, 2026
@alexrobin
alexrobin self-requested a review November 11, 2026 23:55
@alexrobin
alexrobin merged commit f6c8822 into master Nov 11, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants