node-amqplib

amqp nodejs connect on setup api or on route

拟墨画扇 提交于 2021-01-29 07:00:41
问题 Hello i have doubts about amqp lib nodejs about the connection, should i create the connection when uploading my api? Or just at the end point when requested? like this: import express from 'express'; import {connect} from 'amqplib' connect(this.rabbitUrl), 10, 1000) const app = express(); app.get('/', (req, res) => { return res.send('service A'); }); app.listen(3001, () => { console.log(`⚡️ Service A on port 3001`); }); I have another question: I have 10 requests for 10 different clients,

How to manage publish connection per request on rabbitmq(rascal.js)

被刻印的时光 ゝ 提交于 2020-12-15 07:06:18
问题 I am using Rascal.Js(it uses amqplib) for my messaging logic with rabbitMq on node.js app. I am using something similar to their example on my project startup, which creates a permanent instance and "registers" all of my subscribers and redirects messages when they arrive to the queue (in the background). My issue is with the publishers. There are http requests from outside which should trigger my publishers. A user clicks on create button of sorts which leads to certain flow of actions. At

How to manage publish connection per request on rabbitmq(rascal.js)

一曲冷凌霜 提交于 2020-12-15 07:05:30
问题 I am using Rascal.Js(it uses amqplib) for my messaging logic with rabbitMq on node.js app. I am using something similar to their example on my project startup, which creates a permanent instance and "registers" all of my subscribers and redirects messages when they arrive to the queue (in the background). My issue is with the publishers. There are http requests from outside which should trigger my publishers. A user clicks on create button of sorts which leads to certain flow of actions. At