emqx-elixir-plugin
emqx-elixir-plugin copied to clipboard
An Example Plugin for EMQX in Elixir
Example EMQX Elixir Plugin Template
An example Mix project that can be used to build an EMQX 5.0.0 plugin.
Quickstart
-
makeorMIX_ENV=prod mix release --overwrite -
Copy
_build/prod/plugrelex/elixir_plugin_template/elixir_plugin_template-0.1.0.tar.gzto thepluginsdirectory 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" }