I have three (Node) processes P1, P2, P3.
Function A of P1 completes its execution it sends some data to P2.
P2 performs its activities and its output should be sent to P3.
P3 works on the input sends some acknowledgement data to Function B of P1.
All three are different Node applications and runs on different servers (in the same LAN). The question is what should be the communication mechanism between these processes.
Three options appear to be viable:
1) REST API (Express)
Let all the processes be Express REST APIs and using the http
Node package call the required functions
2) Pub/Sub
When P1 completes the work, it post the output as a message to a topic and P2 becomes a subscriber and onMessage
P2 process executes.
3) TCP/IP
A simple TCP/IP server-client architecture where P1 becomes the server client and P2 as server. Whenever P1 completes the work send the output through sockets.
All three options are for used for many to one or many to many communication so I guess there could be a lot of unnecessary overhead as my requirement has only one to one communication between the processes.
Is there any other method that I can use that best suits the dilemma?