MQTT协议开启共享订阅
## Whether the Server supports MQTT Shared Subscriptions. ## ## Value: boolean mqtt.shared_subscription = true
对应的Listener的zone开启mqtt
EMQ X 消息服务器默认开启的 TCP 服务端口包括:
1883 | MQTT TCP 协议端口 |
8883 | MQTT/TCP SSL 端口 |
8083 | MQTT/WebSocket 端口 |
8084 | MQTT/WebSocket with SSL 端口 |
Listener 参数说明:
listener.tcp.${name}.acceptors | TCP Acceptor 池 |
listener.tcp.${name}.max_connections | 最大允许 TCP 连接数 |
listener.tcp.${name}.max_conn_rate | 连接限制配置,例如连接1000/秒: “1000” |
listener.tcp.${name}.zone | 监听属于哪一个 Zone |
listener.tcp.${name}.rate_limit | 连接速率配置,例如限速10B/秒: “100,200” |
例如找到listener.tcp.external.zone=external相应配置,然后去寻找zone.external.*相关配置,并设置如下:
## Whether the Server supports Shared Subscriptions
##
## Value: boolean
zone.external.shared_subscription = true
具体修改哪个listener的哪个zone,要根据具体使用场景(端口),例如客户端使用1883端口,则为TCP Listener(listener.tcp.external = 0.0.0.0:1883),则再需找listener.tcp.external.zone=external对应的zone为external,最终去修改zone.external.*相关配置即可;
指定broker共享订阅的分发策略
## Dispatch strategy for shared subscription
##
## Value: Enum
## - random
## - round_robin
## - sticky
## - hash
broker.shared_subscription_strategy = random## Enable/disable shared dispatch acknowledgement for QoS1 and QoS2 messages
## This should allow messages to be dispatched to a different subscriber in
## the group in case the picked (based on shared_subscription_strategy) one # is offline
##
## Value: Enum
## - true
## - false
broker.shared_dispatch_ack_enabled = false
实际测试仅$share/group/topic形式好用($queue/topic没有生效)