kuzzleio / kuzzle

Open-source Back-end, self-hostable & ready to use - Real-time, storage, advanced search - Web, Apps, Mobile, IoT -
https://kuzzle.io
Apache License 2.0
1.44k stars 124 forks source link

Side-effect: controller plugins trigger before/after events #667

Closed scottinet closed 7 years ago

scottinet commented 7 years ago

Since before/action events are automatically generated by the funnel controller, this means that controller plugins automatically get those.

So, good news: we have a free feature, we only need to document it.

Now, the bad news: these events aren't prefixed with the plugin name. For instance, this means that if I create a controller plugin implementing a document controller with a get action, then the document:beforeGet event gets triggered either for the plugin or for the Kuzzle native API route.

So before documenting our new free feature, we need to fix it.

scottinet commented 7 years ago

Ok, no bad news: funnel generated events come from the controller name, which is always prefixed by the plugin name.

So, if we have a plugin foobar, exposing a document controller with a get action, the funnel will automatically trigger these events:

foobar/document:beforeGet foobar/document:afterGet