-
Notifications
You must be signed in to change notification settings - Fork 69
[ISSUE #305]feat: Introduce Standalone Mode by Allowing Meta Module Disabling #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| enableMultiDispatch = true | ||
| ``` | ||
|
|
||
| ### Deployment Modes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can't be called a deployment mode.
|
|
||
| + 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mqtt proxy is still deployed in a cluster
|
plz commit to the develop branch |
|
|
||
| private boolean enableMetaModule = true; | ||
| private String staticFirstTopics; | ||
| private String localAddress; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need staticFirstTopics and localAddress?
| public CompletableFuture<StoreResult> put(MqttMessageUpContext context, MqttMessage mqttMessage) { | ||
| MqttPublishMessage mqttPublishMessage = (MqttPublishMessage) mqttMessage; | ||
|
|
||
| if (mqttPublishMessage.fixedHeader().isRetain()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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