An example Mix project that can be used to build an EMQX 5.0.0 plugin.
-
make
orMIX_ENV=prod mix release --overwrite
-
Copy
_build/prod/plugrelex/elixir_plugin_template/elixir_plugin_template-0.1.0.tar.gz
to theplugins
directory in your EMQX installation. -
emqx ctl plugins install elixir_plugin_template-0.1.0 emqx ctl plugins enable elixir_plugin_template-0.1.0 emqx ctl plugins start elixir_plugin_template-0.1.0
-
In a console in your broker (
emqx remote_console
)::emqx.subscribe("topic") :emqx.publish(:emqx_message.make("topic", "payload"))
You should see your message printed by the plugin.
emqx_msg: %{ extra: [], flags: %{}, from: :undefined, headers: %{}, id: <<0, 5, 216, 140, 219, 62, 202, 170, 244, 66, 0, 0, 10, 211, 0, 0>>, payload: "payload", qos: 0, timestamp: 1645474368899, topic: "topic" }