javascript - Shedulig service invokation in nifi -


i have 1 generateflowfile processor have 2 attributes userid(equals=1) , parameter (equals=5) , have service should give me repsonse each userid from(1 5) need call 5 times ,what want genreate 5 flowfile in execute script invoke service 5 times related id have tried code below doesn't work me give me advice should ?

var outputstreamcallback = java.type("org.apache.nifi.processor.io.outputstreamcallback"); var standardcharsets = java.type("java.nio.charset.standardcharsets");  date.prototype.isvalid = function () {     return (object.prototype.tostring.call(this) === "[object date]") && !isnan(this.gettime()); };  var flowfile = session.get(); if (flowfile != null)       var userid= flowfile.getattribute('userid') //equals 1 var parameter=flowfile.getattribute('parameter')//equals5 var  i=0;  while(parameter<i) {     var flowfile = session.get();     if (flowfile != null)         flowfile = session.putattribute(flowfile, 'filename', userid + '_' + parameter);       flowfile = session.write(flowfile,         new outputstreamcallback(function (outputstream) {             outputstream.write(0)         }));      session.transfer(flowfile, rel_success)     userid++;     parameter--;     i++; } 

var outputstreamcallback = java.type("org.apache.nifi.processor.io.outputstreamcallback"); var standardcharsets = java.type("java.nio.charset.standardcharsets");  date.prototype.isvalid = function () {     return (object.prototype.tostring.call(this) === "[object date]") && !isnan(this.gettime()); };   var flowfile=session.get() if (flowfile != null) {     var userid = flowfile.getattribute('userid')     var parameter = flowfile.getattribute('parameter')     var = 0;      for(i=0;i<=parameter;i++) {         var flowfile1=session.create();          userid++;         flowfile1 = session.putattribute(flowfile1, 'filename', userid);           flowfile1 = session.write(flowfile1,             new outputstreamcallback(function (outputstream) {                 outputstream.write(0)             }));            session.transfer(flowfile1, rel_success)          parameter--;     }      session.remove(flowfile) } 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -