emqx/apps/emqx_exhook
2020-12-05 13:36:56 +01:00
..
docs refactor(proj) sync 4.3.0 plugins with tracked files 2020-12-05 02:43:04 +01:00
etc refactor(proj): Add apps 2020-12-04 22:11:53 +01:00
include chore(apps): Sync again with 4.3.0 2020-12-05 03:02:35 +01:00
priv chore(apps): Sync again with 4.3.0 2020-12-05 03:02:35 +01:00
sdk refactor(proj): Add apps 2020-12-04 22:11:53 +01:00
src chore(emqx_exhook): Delete old app.src file 2020-12-05 03:04:33 +01:00
test chore(apps): Sync again with 4.3.0 2020-12-05 03:02:35 +01:00
.gitignore refactor(proj) sync 4.3.0 plugins with tracked files 2020-12-05 02:43:04 +01:00
LICENSE refactor(proj): Add apps 2020-12-04 22:11:53 +01:00
README.md refactor(proj) sync 4.3.0 plugins with tracked files 2020-12-05 02:43:04 +01:00
rebar.config chore(rebar): Delete profiles from apps' rebar.config 2020-12-05 13:36:56 +01:00

emqx_extension_hook

The emqx_extension_hook extremly enhance the extensibility for EMQ X. It allow using an others programming language to mount the hooks intead of erlang.

Feature

  • Support python and java.
  • Support all hooks of emqx.
  • Allows you to use the return value to extend emqx behavior.

We temporarily no plans to support other languages. Plaease open a issue if you have to use other programming languages.

Architecture

 EMQ X                                      Third-party Runtimes
+========================+                 +====================+
|    Extension           |                 |                    |
|   +----------------+   |     Hooks       |  Python scripts /  |
|   |    Drivers     | ------------------> |  Java Classes   /  |
|   +----------------+   |     (pipe)      |  Others ...        |
|                        |                 |                    |
+========================+                 +====================+

Drivers

Python

Requirements:

  • It requires the emqx hosted machine has Python3 Runtimes (not support python2)
  • The python3 executable commands in your shell

Examples:

See test/scripts/main.py

Java

Requirements:

  • It requires the emqx hosted machine has Java 8+ Runtimes
  • An executable commands in your shell, i,g: java

Examples:

See test/scripts/Main.java

Configurations

Name Data Type Options Default Description
drivers Enum python3
java
python3 Drivers type
.path String - data/extension The codes/library search path
.call_timeout Duration - 5s Function call timeout
.pool_size Integer - 8 The pool size for the driver
.init_module String - main The module name for initial call

SDK

See sdk/README.md

Known Issues or TODOs

Configurable Log System

  • use stderr to print logs to the emqx console instead of stdout. An alternative is to print the logs to a file.
  • The Java driver can not redirect the stderr stream to erlang vm on Windows platform.

Reference