Skip to content

[Bug] Unable to create multiple connections. #68

@ramhr

Description

@ramhr

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;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions