index.js
950 字节
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.XxlJobExecutor = void 0;
const executor_1 = require("./executor");
class XxlJobExecutor {
executor;
registryInterval;
constructor(opts, jobHandlers) {
const { executorKey, scheduleCenterUrl, accessToken, jobLogPath, } = opts;
this.executor = new executor_1.Executor(executorKey, scheduleCenterUrl, accessToken, jobLogPath, jobHandlers);
}
applyMiddleware({ app, domain }) {
this.executor.applyMiddleware({ app, domain });
const registry = this.executor.registry.bind(this.executor);
registry() && (this.registryInterval = setInterval(registry, 30000));
}
async close() {
if (this.registryInterval) {
clearInterval(this.registryInterval);
}
return this.executor.registryRemove();
}
}
exports.XxlJobExecutor = XxlJobExecutor;
//# sourceMappingURL=index.js.map