天天看點

EMQ插件開發

官方提供了插件模闆

插件模闆

按照自己的意願進行命名

修改etc下的config

[

  {emq_custom_plugin, [

    {"version", "1.0"}

  ]}

].

src下的兩個檔案 一個叫auth 一個叫acl的要加載到

_app檔案中

in start function,

ok = emqttd_access_control:register_mod(auth, emq_custom_plugin, []),  

ok = emqttd_access_control:register_mod(acl, emq_custom_plugin, [])  

in stop function,

ok = emqttd_access_control:unregister_mod(auth, emq_auth_demo),  

ok = emqttd_access_control:unregister_mod(acl, emq_acl_demo),  

clone emq-relx項目:

git clone https://github.com/emqtt/emq-relx.git

Makefile增加`DEPS`:

DEPS += plugin_name

dep_plugin_name = git 插件的url

relx.config中release段落添加:

{plugin_name, load},

在emq-relx下  make

加載插件

./bin/emqttd_ctl plugins load <PluginName>

EMQ插件開發