29 lines
1.0 KiB
JavaScript
Raw Normal View History

2017-07-22 23:39:14 +02:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const log = require("./log");
2017-08-09 00:24:22 +02:00
const mqtt = require("./mqttdispatcher");
2017-07-22 23:39:14 +02:00
class Dispatcher {
constructor() {
2017-08-09 00:21:14 +02:00
this._mqttDispatcher = new mqtt.MqttDispatcher();
this._mqttDispatcher.register('IoT/test', 'print1', (message) => {
2017-07-27 23:38:17 +02:00
log.info("Callback for IoT/test");
log.info(`message is ${message}`);
return `<<${message}>>`;
});
2017-08-09 00:21:14 +02:00
this._mqttDispatcher.register('IoT/test', 'print2', (message) => {
2017-08-09 00:03:57 +02:00
log.info("Callback for IoT/test");
log.info(`message is ${message}`);
return `<<${message}>>`;
});
2017-08-09 00:21:14 +02:00
this._mqttDispatcher.register('IoT/test', 'null1', mqtt.passThrough);
this._mqttDispatcher.register('IoT/test', 'null2', mqtt.passThrough);
2017-07-22 23:39:14 +02:00
}
exec() {
log.info("Dispatcher starting");
2017-08-09 00:21:14 +02:00
this._mqttDispatcher.exec();
2017-07-23 22:55:05 +02:00
log.info("Dispatcher running");
2017-07-22 23:39:14 +02:00
}
}
const dispatcher = new Dispatcher();
dispatcher.exec();
//# sourceMappingURL=main.js.map