feat(shared): add targeted client forwarding support#284
Merged
bittcrafter merged 1 commit intormqtt:masterfrom Sep 13, 2025
Merged
feat(shared): add targeted client forwarding support#284bittcrafter merged 1 commit intormqtt:masterfrom
bittcrafter merged 1 commit intormqtt:masterfrom
Conversation
Refactored the shared module across cluster implementations to support two distinct forwarding modes: 1. **Targeted Client Forwarding** (`forward_to_target_client`): - New method added to directly forward messages to a specific client ID - Handles both local and cross-node forwarding scenarios - Uses gRPC for inter-node communication with timeout handling - Maintains statistics for forwarding operations 2. **Subscription-Based Forwarding** (`forward_to_subscriptions`): - Existing broadcast logic now encapsulated in this method - Maintains previous behavior for non-targeted messages **Key Changes:** * Added `get_target_node_id()` method to router for client-node mapping * Modified main `forwards()` method to dispatch based on `publish.target_clientid` presence * Implemented consistent logic across all cluster implementations (broadcast and raft) * Added proper logging and error handling for cross-node communications * Maintained backward compatibility with existing subscription-based forwarding **Files Modified:** * rmqtt-plugins/rmqtt-cluster-broadcast/src/shared.rs * rmqtt-plugins/rmqtt-cluster-raft/src/router.rs * rmqtt-plugins/rmqtt-cluster-raft/src/shared.rs * rmqtt/src/shared.rs This refactor enables more efficient direct messaging while maintaining existing pub/sub functionality.
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.
Refactored the shared module across cluster implementations to support two distinct forwarding modes:
Targeted Client Forwarding (
forward_to_target_client):Subscription-Based Forwarding (
forward_to_subscriptions):Key Changes:
get_target_node_id()method to router for client-node mappingforwards()method to dispatch based onpublish.target_clientidpresenceFiles Modified:
This refactor enables more efficient direct messaging while maintaining existing pub/sub functionality.