![]() Due to: * Cluster RPC MFA is not idempotent! * There is a lack of rollback for callback's side-effects For instance, when two nodes try to add a cluster-singleton concurrently, one of them will have to wait for the table lock then try to catch-up, then try to apply MFA. The catch-up will have the singleton created, but the initiated initiated multicall apply will fail causing the commit to rollback, but not to 'undo' the singleton creation. Later, the retries will fail indefinitely. |
||
---|---|---|
.. | ||
include | ||
src | ||
test | ||
README.md | ||
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_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.
See
test/emqx_test_resource.erl
for a minimalemqx_resource
implementation;test/emqx_resource_SUITE.erl
for examples ofemqx_resource
usage.