UNPKG

redis-smq

Version:

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

27 lines 1.32 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports._validateQueueExtendedParams = _validateQueueExtendedParams; const _get_queue_properties_js_1 = require("../../../queue-manager/_/_get-queue-properties.js"); const index_js_1 = require("../../../queue-manager/index.js"); const index_js_2 = require("../../../errors/index.js"); function _validateQueueExtendedParams(redisClient, queue, requireGroupId, cb) { const { queueParams, groupId } = queue; (0, _get_queue_properties_js_1._getQueueProperties)(redisClient, queueParams, (err, properties) => { if (err) cb(err); else { if (requireGroupId && (properties === null || properties === void 0 ? void 0 : properties.deliveryModel) === index_js_1.EQueueDeliveryModel.PUB_SUB && !groupId) { cb(new index_js_2.ConsumerGroupRequiredError()); } else if ((properties === null || properties === void 0 ? void 0 : properties.deliveryModel) === index_js_1.EQueueDeliveryModel.POINT_TO_POINT && groupId) { cb(new index_js_2.ConsumerGroupsNotSupportedError()); } else cb(); } }); } //# sourceMappingURL=_validate-queue-extended-params.js.map