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

Fix sumo to support that one event manager to handle multiple docs and vice versa #280

Closed
cabol opened this issue Oct 6, 2016 · 4 comments

Comments

@cabol
Copy link
Contributor

cabol commented Oct 6, 2016

Currently sumo has a big limitation, events are attached to the docs, they keep a one-to-one relationship, which means, there is only one event to one doc. Therefore, it is not possible:

  • One event manager to handle events from different docs.
  • Several event managers added to one doc.

Both scenarios are pretty common, so the idea is fix sumo to support this feature.

One alternative to the config might be, instead of associate one doc to one manager like this:

{events, [
  {my_doc_1, my_event_manager}
]}

Change the config to allow to define a manager with a filter, that might be a list with the docs that we want to get events:

{events, [
  {my_event_manager. [my_doc_1, my_doc_2]},
  % If we want to listen all events from all docs, just let the list empty
  {other_event_manager, []}
]}
@elbrujohalcon
Copy link
Member

I would prefer this for "listen to all events":

{events, [{my_super_manager, all}]}

@cabol
Copy link
Contributor Author

cabol commented Oct 7, 2016

@elbrujohalcon agreed. On other hand, I think the scenario "One event manager to handle events from different docs" might be cover setting the same manager to all docs, e.g.:

{events, [
  {my_doc_1, my_event_manager},
  {my_doc_2, my_event_manager},
  {my_doc_3, my_event_manager},
  . . .
]}

So the only case we still need to solve is: "Several event managers added to one doc". So the other option might be:

{events, [
  {my_doc_1, my_event_manager},
  {my_doc_2, my_event_manager},
  {my_doc_3, [my_event_manager, other_event_manager]},
  . . .
]}

@elbrujohalcon
Copy link
Member

I like your idea, @cabol and I would just add the option to specify '_' as the doc name to represent all docs…

{events, [
  {'_', [my_first_global_event_manager, my_second_global_event_manager]},
  {my_doc_1, my_event_manager},
  {my_doc_2, my_event_manager},
  {my_doc_3, [my_event_manager, other_event_manager]},
  . . .
]}

@cabol
Copy link
Contributor Author

cabol commented Oct 7, 2016

Perfect!

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

No branches or pull requests

2 participants