Search code examples
wso2siddhiwso2-streaming-integrator

How Insert events into http sink apart from one another?


I need to send events to http endpoint. If I do something like :

from DataStream
 select f_id
insert into OutputToHttpEndpoint ;

I have following messages in my webservice: [{f_id:1}, {f_id:2}, ...] instead N request with expected message like {f_id:N}.

I found solution:

from ExtractedDataStream
 select f_id 
 output last every 1 events 
insert into OutputToNodejs ;

Is it's correct? Is there another way to solve this?


Solution

  • Siddhi length batch window of size 1 can be used,

       from DataStream#window.lengthBatch(1)
       select * 
       insert into DataStreamTemp;
    
       from DataStreamTemp 
       select f_id
       insert into OutputToHttpEndpoint ;