A minimal publish/subscribe bus in C++17 + Qt 6 (MinGW). Features:
- Discovery (broadcast/multicast; loopback for local demos)
- Serialization (JSON/CBOR) with format negotiation
- QoS: reliable (ACK/retry) and best-effort
- UDP (unicast/broadcast/multicast) + TCP transports
- Config-driven runtime
- Tests via CTest/QtTest
- English Documentation
- Persian Documentation
- Diagrams:
Diagrams are in PlantUML format. To view them, install the PlantUML extension in VS Code.
- Qt 6.9.2 (mingw_64)
- MinGW 13.x (bundled with Qt Tools)
- CMake
Note: On Windows/MinGW, the single-process
test_integration_scenariosis disabled by default due to known Qt event-loop limitations. All other tests pass. End-to-end behavior is validated via the multi-process demos below. To force-enable it anywhere: setFORCE_ENABLE_INTEGRATION_TESTS=1.
# Ensure tools on PATH (adjust Qt path if needed)
$env:PATH = "C:\Program Files\CMake\bin;C:\Qt\Tools\mingw1310_64\bin;C:\Qt\6.9.2\mingw_64\bin;$env:PATH"
$env:CMAKE_PREFIX_PATH = "C:\Qt\6.9.2\mingw_64\lib\cmake"
# From the repo root:
cmake -S . -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
cmake --build build -- -j
cmake --build build --target qt_deploy_copy_configsctest --test-dir build --timeout 120 --output-on-failure -VExpected on Windows: all tests pass; test_integration_scenarios shows Not Run (Disabled).
Run architecture-focused tests that validate discovery, pub/sub reliable, QoS failure, and discovery cycle behaviors.
PowerShell:
ctest --test-dir build -R "(test_discovery_rx|test_discovery_tx|test_pub2sub_reliable|test_discovery_cycle|test_qos_failure)" --output-on-failure -VBash:
ctest -R "(test_discovery_rx|test_discovery_tx|test_pub2sub_reliable|test_discovery_cycle|test_qos_failure)" -VOpen two PowerShell terminals, then:
Terminal #1 (Subscriber)
.\scripts\run_rx.ps1Terminal #2 (Publisher)
.\scripts\run_tx.ps1You should see on RX: discovery: peer=..., [UDP-IN] len=..., and temperature: {...}. On TX: [ROUTE] topic=... and [SEND][DONE] mid=....
.\scripts\run_1pub_2subs.ps1TX should show routes to 2 peers; both RX windows should print temperature messages.
If your network/firewall permits:
$env:ALLOW_MULTICAST_TESTS = "1"and use the multicast config variant.
Run demos from build\qt_deploy (Qt DLLs are deployed here).
Verbose logs:
$env:QT_LOGGING_RULES = "dds.disc=true;dds.net=true"Full clean rebuild:
if (Test-Path .\build) { Remove-Item -Recurse -Force .\build }
cmake -S . -B build -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
cmake --build build -- -j
ctest --test-dir build --timeout 120 --output-on-failure -Vconfig/ # sample configs
docs/
Architecture.md
diagrams/
component.puml
sequence_publish_reliable.puml
scripts/
run_rx.ps1
run_tx.ps1
run_1pub_2subs.ps1
src/
tests/
build/ # generated by CMake (ignored)
Diagrams in this repo:
docs/diagrams/component.pumldocs/diagrams/sequence_publish_reliable.puml
These are plain PlantUML sources. No code changes are required to render them.
- VS Code + extension PlantUML (
jebbs.plantuml) - Java JDK 17+ (e.g., Eclipse Temurin 17)
- Graphviz (must have
dot.exe)
Add to .vscode/settings.json:
{
"plantuml.render": "Local",
"plantuml.graphvizDot": "C:\\\\Program Files\\\\Graphviz\\\\bin\\\\dot.exe"
}Open a .puml → press Alt+D (or run PlantUML: Preview Current Diagram).
Right-click → Export Current Diagram to PNG/SVG.
From repo root in PowerShell:
# Add Java & Graphviz to PATH for this session
$env:Path = "C:\Program Files\Eclipse Adoptium\jdk-17.0.16.8-hotspot\bin;C:\Program Files\Graphviz\bin;$env:Path"
# Sanity check
java -version
dot -V
# Output folder
New-Item -ItemType Directory -Force -Path docs\diagrams\out | Out-Null
# Use PlantUML jar from the VS Code extension
$jar = Get-ChildItem "$env:USERPROFILE\.vscode\extensions" -Recurse -Filter plantuml.jar -ErrorAction SilentlyContinue | Select-Object -First 1
# Export PNG (use -tsvg for SVG)
java -jar "$($jar.FullName)" -tpng docs\diagrams\component.puml -o out
java -jar "$($jar.FullName)" -tpng docs\diagrams\sequence_publish_reliable.puml -o outGenerated images will appear under docs/diagrams/out/.
Ensure java -version and dot -V work.
Restart VS Code after installing tools.
Files must start with @startuml and end with @enduml.
VS Code workspace must be Trusted.
فایلهای دیاگرام:
docs/diagrams/component.pumldocs/diagrams/sequence_publish_reliable.puml
اینها سورس PlantUML هستند و بدون هیچ تغییری در کد رندر میشوند.
- VS Code + افزونه PlantUML (
jebbs.plantuml) - Java JDK 17+ (مثل Eclipse Temurin 17)
- Graphviz (باید
dot.exeداشته باشد)
در .vscode/settings.json قرار دهید:
{
"plantuml.render": "Local",
"plantuml.graphvizDot": "C:\\\\Program Files\\\\Graphviz\\\\bin\\\\dot.exe"
}فایل .puml را باز کنید → Alt+D
راستکلیک → Export Current Diagram برای خروجی PNG/SVG
در PowerShell و از ریشه ریپو:
$env:Path = "C:\Program Files\Eclipse Adoptium\jdk-17.0.16.8-hotspot\bin;C:\Program Files\Graphviz\bin;$env:Path"
java -version
dot -V
New-Item -ItemType Directory -Force -Path docs\diagrams\out | Out-Null
$jar = Get-ChildItem "$env:USERPROFILE\.vscode\extensions" -Recurse -Filter plantuml.jar -ErrorAction SilentlyContinue | Select-Object -First 1
java -jar "$($jar.FullName)" -tpng docs\diagrams\component.puml -o out
java -jar "$($jar.FullName)" -tpng docs\diagrams\sequence_publish_reliable.puml -o outخروجیها در مسیر docs/diagrams/out/ ساخته میشوند.
اطمینان حاصل کنید که java -version و dot -V کار میکنند.
پس از نصب ابزارها، VS Code را دوباره راهاندازی کنید.
فایلها باید با @startuml شروع و با @enduml پایان یابند.
فضای کاری VS Code باید Trusted باشد.