function getPublisherPipeline(wlstDef) { var myProcessors = []; myProcessors.push(highland.each(function(execObj) { // console.log("===================================================================="); // console.log("F1:", execObj.data.noOfFiles, "\nF2:", execObj.data.insertion); // console.log(execObj); //return execObj; outtream.write("\n====================================================================") outtream.write("\nnoOfFiles:" + execObj.data.noOfFiles + " | insertion:" + execObj.data.insertion); outtream.write("\n" + JSON.stringify(execObj.path, null, true)); })); return highland.pipeline.apply(null, myProcessors); }
var watchPublishPipeline = function(wlstDef) { var myProcessors = []; var socket = new socketClient('http://localhost:8080/'); var roomName = wlstDef.orgsite + "::" + wlstDef.name; socket.emit('join:room', { 'room': roomName }); console.log("Watch room ", roomName); var outLogFile = wlstDef.name; outLogFile = outLogFile.replace(" ", "_") + ".log"; var outtream = fs.createWriteStream(outLogFile, 'utf-8'); if (wlstDef.publishers.dashboard) { myProcessors.push(highland.map(function(execObj) { // console.log("Emmitting data over socket room"); socket.emit('watchlist:onResult', { 'room': { 'name': roomName }, 'message': { 'data': execObj } }); return execObj; })); myProcessors.push(highland.each(function(execObj) { //outtream.write("\n" + JSON.stringify(execObj) + "\n"); outtream.write("."); // console.log("Result: ", execObj.path) return execObj; })); } if (wlstDef.publishers.database.saveas) { //Add a database publisher } if (wlstDef.publishers.outstream.streamname) { //Add a output stream publisher } return highland.pipeline.apply(null, myProcessors); }