[ISSUE #305]feat: Introduce Standalone Mode by Allowing Meta Module Disabling#314
Open
HeartLinked wants to merge 11 commits intoapache:mainfrom
Open
[ISSUE #305]feat: Introduce Standalone Mode by Allowing Meta Module Disabling#314HeartLinked wants to merge 11 commits intoapache:mainfrom
HeartLinked wants to merge 11 commits intoapache:mainfrom
Conversation
DongyuanPan
reviewed
Jun 16, 2025
| enableMultiDispatch = true | ||
| ``` | ||
|
|
||
| ### Deployment Modes |
Contributor
There was a problem hiding this comment.
It can't be called a deployment mode.
DongyuanPan
reviewed
Jun 16, 2025
|
|
||
| + Cluster-Ready Mode (Meta Enabled, Default): This is the default and full-featured mode. It relies on a meta service (based on RocketMQ's KV storage) for dynamic configuration, cluster node discovery, and advanced features like Retain Messages and Will Messages. This mode is suitable for production and high-availability environments. | ||
|
|
||
| + Standalone Mode (Meta Disabled): This is a simplified mode designed for single-node deployments or scenarios where advanced features are not required. It operates without any dependency on the meta service, making configuration and deployment much simpler. In this mode, features like Retain Messages and Will Messages are disabled. |
Contributor
There was a problem hiding this comment.
mqtt proxy is still deployed in a cluster
Contributor
|
plz commit to the develop branch |
DongyuanPan
reviewed
Jun 16, 2025
|
|
||
| private boolean enableMetaModule = true; | ||
| private String staticFirstTopics; | ||
| private String localAddress; |
Contributor
There was a problem hiding this comment.
Why do you need staticFirstTopics and localAddress?
DongyuanPan
reviewed
Jun 16, 2025
| public CompletableFuture<StoreResult> put(MqttMessageUpContext context, MqttMessage mqttMessage) { | ||
| MqttPublishMessage mqttPublishMessage = (MqttPublishMessage) mqttMessage; | ||
|
|
||
| if (mqttPublishMessage.fixedHeader().isRetain()) { |
Contributor
There was a problem hiding this comment.
This code can be simplified and less intrusive. For example
if (mqttPublishMessage.fixedHeader().isRetain() && !serviceConf.isEnableMetaModule()) {
logger.error("Client [{}] on topic [{}] tried to publish a Retain Message, but the meta module is disabled. Rejecting request.",
context.getClientId(), mqttPublishMessage.variableHeader().topicName());
MqttRetainException exception = new MqttRetainException("Retain Message feature is disabled.");
CompletableFuture<StoreResult> failedFuture = new CompletableFuture<>();
failedFuture.completeExceptionally(exception);
return failedFuture;
}
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.
This PR introduces a crucial option to run the RocketMQ-MQTT proxy layer in a configuration that does not depend on an external stateful meta service.
The primary motivation is to simplify deployment and reduce operational overhead for users who do not require stateful features like Retain Messages and Will Messages. By disabling this dependency, users can deploy the stateless MQTT proxy cluster without the need to set up, manage, and operate a separate, Raft-based meta cluster.
Key Changes
This feature is implemented through a series of coordinated changes across the common, ds, and cs modules:
The NotifyManager has been refactored to operate in two modes.When meta is disabled, it subscribes to the topics listed in staticFirstTopics at startup, instead of dynamically refreshing from the meta service. The message notification logic (notifyMessage) is adjusted to perform a local RPC loopback to itself, instead of broadcasting to a cluster of nodes.
To ensure system stability, features dependent on the meta module are now gated by the enableMetaModule switch.
How to Configure and Test Standalone Mode
Connect a client with a Will Message set. The server should refuse the connection.
With an active connection, publish a message with the retain flag set to true. The server should close the connection.
Related Issue
fix #305