The CRONListener SIB Listener triggers a dataflow according to a number of configured scedules.
Module | sib_cronlistener |
Version | 1.3.3 |
var CRONCustom = { _id: "cronsample:1", _name: "SIB Cron Listener Sample", init: ( thisListener )=>{}, inputFormat: (topic, msg, callback)=>{ callback( msg ); }, loggerCfg: { dest: { file: false, console: true, mqtt: true } }, outputFormat: (topic, msg, callback)=>{ callback( msg ); }, publishOutput: (msg, mqttClient)=>{ mqttClient.publish( msg._sibheader.topic, JSON.stringify( msg ) ); }, publishInput: (msg, mqttClient)=>{ mqttClient.publish( msg._sibheader.topic, JSON.stringify( msg ) ); }, schedules: [ {schedule: "*/30 * * * * *", topic:"SIB/SAMPLES/CRONLISTENER/EVERY30SECONDS", responseTopic: "SIB/SAMPES/OUT30", payload:{}}, {schedule: "* * * * *", topic: "SIB/SAMPLES/CRONLISTENER/EVERYMINUTE", payload:{a:1}}, {schedule: "*/2 * * * *", topic: "SIB/SAMPLES/CRONLISTENER/EVERYTWOMINUTES", payload:{a:2}, responseFilter:(topic,msg)=>{return (msg._sibheader.responder='a.b.c');}} ], mqtt: "mqtt://192.168.126.129", reQTopic: "SIB/SAMPLES/CRONLISTENER/REQ" }; module.exports = CRONCustom;