Skip to content

Commit

Permalink
Added new configuration settings of moquette
Browse files Browse the repository at this point in the history
  • Loading branch information
hylkevds committed Jun 3, 2022
1 parent 9fbd00c commit 3c04a28
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Expand Up @@ -85,6 +85,11 @@ public class MoquetteMqttServer implements MqttServer, ConfigDefaults {
public static final String TAG_SSL_WEBSOCKET_PORT = "secureWebsocketPort";
@DefaultValue("memory")
public static final String TAG_PERSISTENT_STORE_TYPE = "persistentStoreType";
@DefaultValueInt(1024)
public static final String TAG_SESSION_QUEUE_SIZE = BrokerConstants.SESSION_QUEUE_SIZE;
@DefaultValueInt(BrokerConstants.DEFAULT_SESSION_TIMEOUT_SECONDS)
public static final String TAG_SESSION_TIMEOUT_SECONDS = BrokerConstants.SESSION_TIMEOUT_SECONDS_NAME;


private static final String VALUE_STORE_TYPE_H2 = "h2";

Expand Down Expand Up @@ -181,6 +186,9 @@ public void start() {
config.setProperty(BrokerConstants.HOST_PROPERTY_NAME, mqttSettings.getHost());
config.setProperty(BrokerConstants.ALLOW_ANONYMOUS_PROPERTY_NAME, Boolean.TRUE.toString());

config.setProperty(BrokerConstants.SESSION_QUEUE_SIZE, customSettings.get(TAG_SESSION_QUEUE_SIZE, getClass()));
config.setProperty(BrokerConstants.SESSION_TIMEOUT_SECONDS_NAME, customSettings.get(TAG_SESSION_TIMEOUT_SECONDS, getClass()));

final String nettyMaxMessageSize = customSettings.get(BrokerConstants.NETTY_MAX_BYTES_PROPERTY_NAME, Integer.toString(BrokerConstants.DEFAULT_NETTY_MAX_BYTES_IN_MESSAGE));
config.setProperty(BrokerConstants.NETTY_MAX_BYTES_PROPERTY_NAME, nettyMaxMessageSize);

Expand Down
6 changes: 6 additions & 0 deletions docs/settings/settings.md
Expand Up @@ -133,6 +133,12 @@ These are settings for the MQTT package.
* **mqtt.persistentStoreType:**
The way the MQTT server keeps track of subscriptions, either in-memory (`memory`) or using an H2 database (`h2`).
Default: `memory`.
* **mqtt.session_queue_size:**
The size of the internal queue the mqtt broker uses per CPU core.
Default: `1024`.
* **mqtt.session_timeout_seconds:**
The maximum lifetime of disconnected sessions, in seconds.
Default: `3600`.
* **mqtt.maxInFlight:**
The maximum number of "in-flight" messages to allow when sending notifications.
* **mqtt.netty.mqtt.message_size:**
Expand Down

0 comments on commit 3c04a28

Please sign in to comment.