UNPKG

redis-smq

Version:

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

29 lines 1.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._getTopicExchangeQueues = _getTopicExchangeQueues; const redis_smq_common_1 = require("redis-smq-common"); const _get_queues_js_1 = require("../../../queue/_/_get-queues.js"); const _get_topic_exchange_params_js_1 = require("./_get-topic-exchange-params.js"); function _getTopicExchangeQueues(redisClient, topic, cb) { const topicParams = (0, _get_topic_exchange_params_js_1._getTopicExchangeParams)(topic); if (topicParams instanceof Error) cb(topicParams); else { (0, _get_queues_js_1._getQueues)(redisClient, (err, queues) => { if (err) cb(err); else if (!queues) cb(new redis_smq_common_1.CallbackEmptyReplyError()); else { const matched = []; const regExp = new RegExp(topicParams.topic); redis_smq_common_1.async.eachOf(queues, (queue, index, done) => { if (queue.ns === topicParams.ns && regExp.test(queue.name)) matched.push(queue); done(); }, (err) => cb(err, matched)); } }); } } //# sourceMappingURL=_get-topic-exchange-queues.js.map