问题
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, will a connection be made for each client? or is it just a connection to rabbitmq for all requests
来源:https://stackoverflow.com/questions/63813890/amqp-nodejs-connect-on-setup-api-or-on-route