![]() * refator(config_handler): handle and validate the updates to raw_configs * fix(hocon): update hocon to 0.8.0 * refactor(config_handler): check and apply envs only in top-level handler * refactor(config_handler): update config from top level to bottom level * refactor(emqx_data_bridge): move configs to emqx.conf * fix(emqx_schema): remove the extra config path * fix(config_handler): load the emqx.conf when starting emqx_config_handler * fix(data_bridge): API not working * feat(config_handler): save updated configs to emqx_override.conf * fix(config_handler): cannot find the emqx.conf and emqx_override.conf * fix(emqx_config): cannot find the correct path for etc dir * fix(test): load load emqx_schema foreign refereced apps * refactor(emqx_plugin): do not generate configs before load plugins All configs (including the configs for plugins) now should go into the `emqx.conf`. * fix(tests): update the test cases for plugins * fix(tests): don't include schema from apps when testing * fix(tests): use emqx-ct-helper branch hocon |
||
---|---|---|
.. | ||
examples | ||
include | ||
scripts | ||
src | ||
Makefile | ||
README.md | ||
demo.sh | ||
elvis.config | ||
rebar.config |
README.md
emqx_resource
The emqx_resource
is a behavior that manages configuration specs and runtime states
for resources like mysql or redis backends.
It is intended to be used by the emqx_data_bridges and all other resources that need CRUD operations to their configs, and need to initialize the states when creating.
There can be foreign references between resource instances via resource-id. So they may find each other via this Id.
The main idea of the emqx resource is to put all the general
code in a common lib, including
the config operations (like config validation, config dump back to files), and the state management.
And we put all the specific
codes to the callback modules.
Try it out
$ ./demo.sh
Eshell V11.1.8 (abort with ^G)
1> == the demo log tracer <<"log_tracer_clientid_shawn">> started.
config: #{<<"config">> =>
#{<<"bulk">> => <<"10KB">>,<<"cache_log_dir">> => <<"/tmp">>,
<<"condition">> => #{<<"clientid">> => <<"abc">>},
<<"level">> => <<"debug">>},
<<"id">> => <<"log_tracer_clientid_shawn">>,
<<"resource_type">> => <<"log_tracer">>}
1> emqx_resource_instance:health_check(<<"log_tracer_clientid_shawn">>).
== the demo log tracer <<"log_tracer_clientid_shawn">> is working well
state: #{health_checked => 1,logger_handler_id => abc}
ok
2> emqx_resource_instance:health_check(<<"log_tracer_clientid_shawn">>).
== the demo log tracer <<"log_tracer_clientid_shawn">> is working well
state: #{health_checked => 2,logger_handler_id => abc}
ok
3> emqx_resource_instance:query(<<"log_tracer_clientid_shawn">>, get_log).
== the demo log tracer <<"log_tracer_clientid_shawn">> received request: get_log
state: #{health_checked => 2,logger_handler_id => abc}
"this is a demo log messages..."
4> emqx_resource_instance:remove(<<"log_tracer_clientid_shawn">>).
== the demo log tracer <<"log_tracer_clientid_shawn">> stopped.
state: #{health_checked => 0,logger_handler_id => abc}
ok
5> emqx_resource_instance:query(<<"log_tracer_clientid_shawn">>, get_log).
** exception error: {get_instance,{<<"log_tracer_clientid_shawn">>,not_found}}