F
F
Fengol2018-05-09 11:21:04
Node.js
Fengol, 2018-05-09 11:21:04

How to "link" parallel processes in nodejs?

I'm using a library that uses another ( https://github.com/rvagg/node-worker-farm) library to run processes in parallel. These processes use the code I wrote, which needs to be "connected" somehow, to establish a connection between these parallel processes and the parent. How to do it? This is the first time I’ve come across something like this and I don’t even know where to start, so I’ll be glad for any specifics and code.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Arkhipov, 2018-05-09
@Fengol

Look, here I see that this library returns an object of type ChildProcess .
So you can send a message to a child process and receive it.
If you need more complex logic, then you can use pipes or tcp connections. Or any other way of inter-process communication (google, nodejs IPC or nodejs inter-process communication).

A
Alexey Shashenkov, 2018-05-09
@teknik2008

I am using Redis. You can use Nsq. Everything depends on the tasks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question