bringg/node-arnavmq

[Bug] Unable to create multiple connections.

Opened this issue · 0 comments

When calling arnavmq multiple times to create multiple connections to different servers, it does not actually create a new connection each time. Instead, it just replaces the configuration of the old connection.

When calling the arnavmq lib it does:

return require('./modules/arnavmq')(connection(configuration));

While the connection function just returns the same singleton with updated configuration:

let instance;
module.exports = (config) => {
assert(instance || config, 'Connection can not be created because config does not exist');
assert(config.hostname);
if (!instance) {
instance = new Connection(config);
} else {
instance.config = config;
}
return instance;
};