Merged
Conversation
…ing dynamic channel capacity
…ogic across MCU, edge, and cloud platforms. - Implemented common data types (`Temperature`, `TemperatureCommand`) and monitor functions (`temperature_logger`, `command_consumer`). - Updated `tokio-mqtt-connector-demo` to utilize shared logic for temperature producers and command consumers. - Enhanced `tokio-knx-connector-demo` to leverage shared types and monitors for temperature and light state handling. - Improved documentation for clarity on usage and architecture.
- Updated the `produce` and `subscribe` methods in the Database struct to require a record key, enabling key-based routing for multiple records of the same type. - Removed the optional record key handling in the Producer and Consumer structs, making the record key mandatory for all instances. - Adjusted the API documentation and examples to reflect the new key-based usage pattern. - Modified the integration tests and examples to utilize the new key-based producer and consumer methods. - Cleaned up unused code related to optional key handling and legacy type-based routing.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical MQTT connector deadlock (Issue #63) and introduces shared demo crates for cross-platform code reuse.
Key changes:
- Fixed MQTT deadlock when subscribing to >10 topics via spawn-before-subscribe pattern and dynamic channel capacity
- Created
mqtt-connector-demo-commonandknx-connector-demo-commoncrates for shared types/monitors - Updated all demos to use key-based API from v0.3.0
Reviewed changes
Copilot reviewed 48 out of 49 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| aimdb-mqtt-connector/src/tokio_client.rs | Implements deadlock fix: spawn event loop before subscribing, dynamic capacity |
| examples/mqtt-connector-demo-common/* | New shared crate for MQTT types and monitors (Temperature, TemperatureCommand) |
| examples/knx-connector-demo-common/* | New shared crate for KNX types and monitors (TemperatureReading, LightState) |
| examples/tokio-mqtt-connector-demo/src/main.rs | Refactored to use common crate with multiple sensor producers |
| examples/tokio-knx-connector-demo/src/main.rs | Refactored to use common crate with multiple sensor/light monitors |
| aimdb-mqtt-connector/CHANGELOG.md | Documents deadlock fix and demo refactoring |
| tools/aimdb-mcp/CHANGELOG.md | Updated for v0.3.0 release |
| aimdb-core/CHANGELOG.md | Documents key-based API changes and removed legacy methods |
Comments suppressed due to low confidence (2)
tools/aimdb-mcp/CHANGELOG.md:1
- The release date '2025-12-15' is in the future. Based on the knowledge cutoff of January 2025 and current date of December 23, 2025, this should likely be '2024-12-15'.
tools/aimdb-cli/CHANGELOG.md:1 - The release date '2025-12-15' is in the future. This should be corrected to '2024-12-15' as December 2025 has not yet occurred.
Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 48 out of 49 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
tools/aimdb-mcp/CHANGELOG.md:1
- The release date
2025-12-15is in the future. Based on the system date (December 23, 2025), this should likely be2024-12-15instead.
tools/aimdb-cli/CHANGELOG.md:1 - The release date
2025-12-15is in the future. Based on the system date (December 23, 2025), this should likely be2024-12-15instead.
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
This PR fixes a critical MQTT connector deadlock (Issue #63) and introduces shared demo crates for cross-platform code reuse.
🐛 Bug Fix
MQTT Connector Deadlock with >10 Topics (Issue #63)
Fixed an initialization deadlock when subscribing to more than 10 MQTT topics. The root cause was that
rumqttc's internal channel had a hardcoded capacity of 10, causing the subscribe loop to block when topics exceeded channel capacity before the event loop started draining.Fix:
topics + 10)tokio::task::yield_now().awaitto ensure proper task scheduling✨ New Features
Shared Demo Common Crates
mqtt-connector-demo-common: Shared types and monitors for MQTT demosknx-connector-demo-common: Shared types and monitors for KNX demosThese crates enable code reuse between Tokio (std) and Embassy (embedded) demos, demonstrating the "write once, run everywhere" pattern for MCU → edge → cloud.
📝 Documentation
016-M6-record-key-trait.mdfor RecordKey trait design🔧 Dependencies
rumqttcfrom 0.24 to 0.25embassyandmountain-mqttsubmodulesOpenSSLlicense allowance indeny.toml✅ Testing
make checkpasses (fmt, clippy, test, embedded cross-compile, deny)Breaking Changes
None for library consumers. Demo examples updated to use key-based API from v0.3.0.
Closes #63