I am trying to use rascal.js with my node.js app to publish messages via RabbitMQ.
To simplify things:
I got the standard rascal.js file which looks similar to their docs. And I got a controller.js file which receives http request for saving some data. Then this controller.js file calls 2 functions on different files. "SendMail" and "NotifyUser". Both of those functions needs to publish messages to specific queues.
The question how can I access the Rascal.js publish logic from those 2 files? I could not find any examples. Maybe the publish logic suppose to be activated differently? By triggers or events of sort?
And so far the only solution I could use was creating another separate function in my rascal.js file which opens a connection specifically for publishing. It uses input params to determine the name of the queue and the message to be published to it and at the end it closes the connection. This seems to be a bad solution since every request will open a new connection with rascal.js.
this is my first post in this subject - How to manage publish connection per request on rabbitmq(rascal.js)