Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable 3rd party plugins to propagate events through the cluster #47

Closed
ballinette opened this issue Aug 30, 2017 · 0 comments
Closed

Comments

@ballinette
Copy link

ballinette commented Aug 30, 2017

Idea: expose to plugins a method to trigger an event that will be propagated to other cluster nodes.

example :

class MyPlugin {
  // Hook configuration:
  constructor () {
    this.hooks = {
      'plugin-my-plugin:my-custom-event': 'myFunction'
    };
  }
  myFunction(payload) {
    this.doSomething(payload);
  }

  
  // broadcast an event to other nodes:
  myCustomMethod() {
    // (....)
    // if the plugin-cluster is not enabled => the `broadcast` method will do nothing
    // if it is enabled, it will encapsulate the event, send it to other cluster nodes,
    //                         and then in each node, trigger a `plugin-my-plugin:my-custom-event` hook:
    context.accessors.broadcast('my-custom-event', payload);
  }

see also comments here: kuzzleio/documentation#339 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants