UNPKG

redis-smq

Version:

A high-performance, reliable, and scalable message queue for Node.js.

21 lines 1.04 kB
import { CallbackEmptyReplyError, } from 'redis-smq-common'; import { redisKeys } from '../../../common/redis/redis-keys/redis-keys.js'; import { _parseExchangeParams } from '../../_/_parse-exchange-params.js'; import { EExchangeType } from '../../types/index.js'; export function _getRoutingPatternBoundQueues(redisClient, bindingPattern, exchange, cb) { const exchangeParams = _parseExchangeParams(exchange, EExchangeType.TOPIC); if (exchangeParams instanceof Error) cb(exchangeParams); else { const { keyBindingPatternQueues } = redisKeys.getExchangeTopicBindingPatternKeys(exchangeParams.ns, exchangeParams.name, bindingPattern); redisClient.smembers(keyBindingPatternQueues, (err, reply) => { if (err) return cb(err); if (!reply) return cb(new CallbackEmptyReplyError()); const queues = reply.map((i) => JSON.parse(i)); cb(null, queues); }); } } //# sourceMappingURL=_get-routing-pattern-bound-queues.js.map