Skip to content

Plugin Configuration

EMQX Edge supports a plugin framework that allows users to extend broker functionality by implementing custom plugins. These plugins can be loaded at runtime and invoked through predefined hook points during broker operation.

During startup, EMQX Edge reads the configuration file and loads any user-defined plugins specified under the plugin section. These plugins are then triggered at relevant hook points.

Supported Hook Points

Currently, EMQX Edge provides the following hook:

  • HOOK_USER_PROPERTY: Allows users to inject custom User Properties during the MQTT 5 message transmission phase.

Plugin Example

A sample plugin demonstrating the use of HOOK_USER_PROPERTY is provided for reference at:

bash
nanomq/plugin/plugin_user_property.c

To compile the plugin, use the following gcc command to generate a shared object:

bash
gcc -I../ -fPIC -shared plugin_user_property.c -o plugin_user_property.so

Example Configuration

The following is an example configuration for enabling the compiled plugin in EMQX Edge:

hcl
plugin {
  libs = [{
    path = "/path/to/plugin_user_property.so"
  }]
}

Configuration Items

  • plugin.libs.path: Specifies the file path to the compiled plugin (.so file).