forked from bigbluebutton/bbb-webhooks
-
Notifications
You must be signed in to change notification settings - Fork 2
/
application.js
50 lines (44 loc) · 1.29 KB
/
application.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import config from 'config';
import Logger from './src/common/logger.js';
import ModuleManager from './src/modules/index.js';
import EventProcessor from './src/process/event-processor.js';
/**
* Application.
* @class
* @classdesc Wrapper class for the whole bbb-webhooks application.
* @property {ModuleManager} moduleManager - Module manager.
* @property {EventProcessor} eventProcessor - Event processor.
* @property {boolean} _initialized - Initialized.
*/
class Application {
/**
* constructor.
* @constructs Application
*/
constructor() {
this.moduleManager = new ModuleManager(config.get("modules"));
this.eventProcessor = null;
this._initialized = false;
}
/**
* start.
* @returns {Promise} Promise.
* @async
* @public
*/
async start() {
if (this._initialized) return Promise.resolve();
const { inputModules, outputModules } = await this.moduleManager.load();
this.eventProcessor = new EventProcessor(inputModules, outputModules);
await this.eventProcessor.start();
return Promise.all([
]).then(() => {
Logger.info("bbb-webhooks started");
this._initialized = true;
}).catch((error) => {
Logger.error("Error starting bbb-webhooks", error);
process.exit(1);
});
}
}
export default Application;