Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use javascript functions inside javascript functions in Siddhi App?

I have been working on a Siddhi App. Inside this app I have JavaScript functions. I have found a problem when trying to use the function inside the function. Lets say:

define function sum[JavaScript ] return double {
   return data[0]+ data[1];
}
define function getthesum[JavaScript] return double {
   var s = sum(5,1); 
   return s; 
}

But when I do this, "sum" is not defined appears in the logs.

like image 996
Jorge Monroy Avatar asked Aug 18 '26 01:08

Jorge Monroy


1 Answers

The function defined here can be only used within Siddhi queries, and they cannot be used in an integrative manner with each other.

E.g you can do

from FooStream 
select sum(a,b) as total
insert into BarStream; 

And here the getthesum() is not correct.

like image 83
suho Avatar answered Aug 19 '26 15:08

suho



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!