@lexamica-modules/job-queue
Version:
The package for the Lexamica Job Queue SDK powered by Redis and BullMQ
30 lines (29 loc) • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Mainframe = void 0;
const config_1 = require("../util/config");
const common_1 = require("./common");
const types_1 = require("../types");
// ingest the global config and come up with a list of queue names to create
const INITS = Object.entries(config_1.QUEUES_INIT).reduce((prev, [name, config]) => {
if (config.mainframe.init) {
return [...prev, name];
}
else {
return prev;
}
}, []);
/**
* This is the instance for the central Lexamica API. This instance has access to almost all queues so that the Lexamica API can assign, manage, and process jobs.
*/
class Mainframe extends common_1.CommonQueueManagement {
/**
* Initialize a mainframe instance using an optional manual list of queues and an optional remote Redis url
* @param connection_url if given, instance will connect to this remote Redis. Otherwise a local instance will be used.
* @param initQueues if given, local queue instances will be built off of this. Recommend not specifying this unless you know what you are doing.
*/
constructor(connection_url, initQueues) {
super(initQueues ?? INITS, types_1.Consumers.MAINFRAME, connection_url);
}
}
exports.Mainframe = Mainframe;