@team-supercharge/nest-amqp
Version:
AMQP 1.0 module for Nest framework
38 lines (37 loc) • 1.01 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AMQConnectionStorage = void 0;
class AMQConnectionStorage {
/**
* Add Connection to storage
*
* @param {string} name Name of the Connection, will be used as key
* @param {Connection} connection The connection object
*/
static add(name, connection) {
this.storage.set(name, connection);
}
/**
* Retreive stored Connection from storage
*
* @param {string} name Name of the connection
*
* @returns {Connection | null} The stored connection or null
*/
static get(name) {
if (!name) {
return null;
}
return this.storage.get(name) || null;
}
/**
* Get all connection keys
*
* @returns {string[]}
*/
static getConnectionNames() {
return Array.from(this.storage.keys());
}
}
exports.AMQConnectionStorage = AMQConnectionStorage;
AMQConnectionStorage.storage = new Map();