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

Workers communication strategy #66

Open
TCMiranda opened this issue Feb 13, 2016 · 2 comments
Open

Workers communication strategy #66

TCMiranda opened this issue Feb 13, 2016 · 2 comments

Comments

@TCMiranda
Copy link

Hello guys,

I am using Pigato in some projects for now, but sometimes I still get confusing about allowing workers to communicate or even to use each others services.

In some scenarios, I prefer to not allow sub levels of workers, but in other scenarios, this gives me much duplicate code, which I solve creating shared modules.

To illustrate a little better:
captura de tela de 2016-02-13 21 19 52

So, what are your thoughts about it?
Does anyone knows some good reference on this subject?

@prdn
Copy link
Owner

prdn commented Feb 15, 2016

@TCMiranda in my opinion the right solution is the first.
Workers can communicate between them via a Pigato client as well, so no need of direct interaction.

Sometimes you may want to reuse code between multiple workers.
There you have two solutions:

  1. use a shared library via a separate github/npm project: suggested when you want to share simple solutions
  2. create dedicated workers: suggested for the rest of usecases.

@TCMiranda
Copy link
Author

@prdn thanks for your answer!

So, if workers are connected to the "handlers broker" as clients, you would agree to allow them to "communicate" by messages without a separate layer like the second case?

Like this:
screenshot from 2016-02-15 15-53-56

The second solution you mentioned would be that case when a worker posts another message as a client to finish its request, right?

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