UNPKG

redis-smq

Version:

A simple high-performance Redis message queue for Node.js.

43 lines 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ExchangeTopic = void 0; const redis_smq_common_1 = require("redis-smq-common"); const exchange_abstract_js_1 = require("../exchange-abstract.js"); const _get_topic_exchange_params_js_1 = require("./_/_get-topic-exchange-params.js"); const _get_topic_exchange_queues_js_1 = require("./_/_get-topic-exchange-queues.js"); class ExchangeTopic extends exchange_abstract_js_1.ExchangeAbstract { constructor() { super(); this.logger.info('ExchangeTopic initialized'); } getQueues(exchangeParams, cb) { this.logger.debug(`Getting queues for topic exchange`, { exchangeParams }); const topic = (0, _get_topic_exchange_params_js_1._getTopicExchangeParams)(exchangeParams); if (topic instanceof Error) { this.logger.error(`Invalid topic exchange parameters`, { error: topic.message, }); return cb(topic); } (0, redis_smq_common_1.withRedisClient)(this.redisClient, (client, cb) => { this.logger.debug(`Getting topic exchange queues`, { topic }); (0, _get_topic_exchange_queues_js_1._getTopicExchangeQueues)(client, topic, (err, queues) => { if (err) { this.logger.error(`Failed to get topic exchange queues`, { error: err.message, }); cb(err); } else { this.logger.debug(`Successfully retrieved topic exchange queues`, { topic, queueCount: (queues === null || queues === void 0 ? void 0 : queues.length) || 0, }); cb(null, queues); } }); }, cb); } } exports.ExchangeTopic = ExchangeTopic; //# sourceMappingURL=exchange-topic.js.map