Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thalesmg/emqx-elixir-plugin-template
Example Elixir plugin template repo
https://github.com/thalesmg/emqx-elixir-plugin-template
Last synced: 10 days ago
JSON representation
Example Elixir plugin template repo
- Host: GitHub
- URL: https://github.com/thalesmg/emqx-elixir-plugin-template
- Owner: thalesmg
- Created: 2022-02-21T20:18:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-02-23T17:44:13.000Z (over 2 years ago)
- Last Synced: 2023-03-05T07:38:54.811Z (over 1 year ago)
- Language: Elixir
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Example EMQX Elixir Plugin Template
An example Mix project that can be used to build an EMQX 5.0.0 plugin.
## Quickstart
1. `make` or `MIX_ENV=prod mix release --overwrite`
2. Copy `_build/prod/plugrelex/example/example-0.1.0` to the `plugins` directory in your EMQX installation.
3. ```sh
emqx ctl plugins install example-0.1.0
emqx ctl plugins enable example-0.1.0
emqx ctl plugins start example-0.1.0
```
4. In a console in your broker (`emqx remote_console`):```elixir
:emqx.subscribe("topic")
:emqx.publish(:emqx_message.make("topic", "payload"))
```You should see your message printed by the plugin.
```elixir
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"
}
```