@midwayjs/bullmq
Version:
midway component for BullMQ
38 lines • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.InjectFlowProducer = exports.InjectWorker = exports.InjectQueue = exports.Processor = void 0;
const core_1 = require("@midwayjs/core");
const constants_1 = require("./constants");
function Processor(queueName, jobOptions, workerOptions, queueOptions) {
return function (target) {
(0, core_1.saveModule)(constants_1.BULLMQ_PROCESSOR_KEY, target);
(0, core_1.saveClassMetadata)(constants_1.BULLMQ_PROCESSOR_KEY, {
queueName,
jobOptions,
workerOptions,
queueOptions,
}, target);
(0, core_1.Provide)()(target);
(0, core_1.Scope)(core_1.ScopeEnum.Request)(target);
};
}
exports.Processor = Processor;
function InjectQueue(queueName) {
return (0, core_1.createCustomPropertyDecorator)(constants_1.BULLMQ_QUEUE_KEY, {
queueName,
});
}
exports.InjectQueue = InjectQueue;
function InjectWorker(queueName) {
return (0, core_1.createCustomPropertyDecorator)(constants_1.BULLMQ_WORKER_KEY, {
queueName,
});
}
exports.InjectWorker = InjectWorker;
function InjectFlowProducer(producerName) {
return (0, core_1.createCustomPropertyDecorator)(constants_1.BULLMQ_FLOW_PRODUCER_KEY, {
producerName,
});
}
exports.InjectFlowProducer = InjectFlowProducer;
//# sourceMappingURL=decorator.js.map