Tuesday 16 May 2017

When using RabbitMQ / AMQP and NodeJS with separate web and worker processes, should a new connection be opened for each process?

I am currently attempting to build a NodeJS webapp that has a web process and a worker process, and using AMQP to communicate between them. With my current setup, starting the application involves launching a script for the web process (server.js) and another script for the worker process (worker.js). Each of them include a third file, amqp.js which uses a start function that involves creating a connection, then creating a channel, then asserting queues.

However, in attempting to debug another issue, I came across this article which appears to show a different structure: A connection is created first, and then the two processes are launched, each creating a channel to that connection and asserting two queues.

Which is the optimal model for creating web/worker communication, and is it possible for me to implement it in an environment where the web and the worker are separate and cannot otherwise communicate?



via DaemonOfTheWest

No comments:

Post a Comment