I am trying run a siddhi app with javascript functions, but when I send the app to the manager in order to deploy it in the distributed workers, it never deploys.
I tried removing the reference to the javascript function in the queries, and it deploys, but in the deployed application there is not the javascript code.
This is the siddhi app:
@App:name("TestApp01")
define function sum[JavaScript] return double {
return data[0] + data[1];
};
define stream SourceStream (id string, value1 double, value2 double);
@sink(type='log', prefix='received information...')
define stream SinkStream (id string, value1 double);
@info(name='Tags')
@dist(parallel='1')
from SourceStream
select id, sum(value1, value2) as value1
insert into SinkStream;
The errors that I am getting in the manager are these:
WARN {org.wso2.carbon.sp.jobmanager.core.deployment.DeploymentManagerImpl} - Couldn't deploy partial Siddhi app TestApp01-1875a7b7-5c20-4f68-80b5-479296c7cd0f-1 in ResourceNode { id: wso2sp-worker-2, host: wso2sp-worker-2, port: 9443 }. Will retry in 2000 milliseconds.
WARN {org.wso2.carbon.sp.jobmanager.core.deployment.DeploymentManagerImpl} - Couldn't deploy partial Siddhi app TestApp01-1875a7b7-5c20-4f68-80b5-479296c7cd0f-1 in ResourceNode { id: wso2sp-worker-1, host: wso2sp-worker-1, port: 9443 }. Will retry in 2000 milliseconds.
And the error that I am getting in the workers is this:
ERROR {org.wso2.carbon.stream.processor.core.internal.StreamProcessorService} - Exception occurred when validating Siddhi App TestApp01-1875a7b7-5c20-4f68-80b5-479296c7cd0f-1 org.wso2.siddhi.core.exception.SiddhiAppCreationException: Error on 'TestApp01-1875a7b7-5c20-4f68-80b5-479296c7cd0f-1' @ Line: 8. Position: 30, near 'sum(value1, value2)'.
And if I remove the javascript call, it deploys, but without deleting the javascript code from the resulting app. This is the code deployed in worker without the javascript function:
@App:name('TestApp01-2055a886-06ea-407d-9d42-e549a6cf47b3-1')
@source(type='kafka', topic.list='TestApp01.SourceStream', group.id='TestApp01-2055a886-06ea-407d-9d42-e549a6cf47b3-0', threading.option='single.thread', bootstrap.servers='kafka:9092', @map(type='xml'))define stream SourceStream (id string, value1 double, value2 double);
@sink(type='log', prefix='received information...')
define stream SinkStream (id string, value1 double);
@info(name='Tags')
from SourceStream
select id, (value1 + value2) as value1
insert into SinkStream;
I expect to deploy the siddhi app using javascript functions, but it is not being deployed with that part of the code.