通过修改配置文件即可实现。
emq v2.3.11,软件架构做了调整,把功能集成在了emq_modules模块,/data/loaded_plugins默认会加载emq_modules。
我们只需要改动配置文件emqx-rel-2.3.11/deps/emq_modules/etc/emq_modules.conf
##--------------------------------------------------------------------
## Subscription Module
##--------------------------------------------------------------------
## Enable Subscription Module.
##
## Value: on | off
module.subscription = on
## Subscribe the Topics automatically when client connected.
module.subscription.1.topic = %c/w
## Qos of the subscription: 0 | 1 | 2
把module.subscription设置为on,
把module.subscription.1.topic设置为%c/w,%c是通配符,会自动切换成clientId。注意是%c,而不是$c。