siddhistream-processingwso2-streaming-integrator

Is it possible to generate and use a dynamic URL in WSO2SP?


Is it possible to generate and use a dynamic URL as publisher.url in a http sink request?

I have an input stream that takes in a parameter. Depending on what value I pass as in this stream, this should be included as part of the base URL, which will receive parameters from another stream.

@App:name("TestApp")

@source(type='http', receiver.url='http://0.0.0.0:8008/xyz', @map(type = 'json', @attributes(a='$.b', b='$.b', c='$.c', var='$.var'))) 
@sink(type='log') 
define stream InputStream(a string, b string, c string, var string);

@source(type='http-response' ,sink.id='1234', @map(type='json', @attributes(a1='a1', a2='a2', a3='a3'))) 
@sink(type='log') 
define stream ResponseStream (a1 string, a2 string, a3 string);

@sink(type='http-request', sink.id='1234', publisher.url='http://<host>:<port>/<var>/parse?a={{a}}&b={{b}}&c={{c}}', method='GET', headers="'Content-Type:text/plain'", @map(type='keyvalue', @payload(a='{{b}}', b='{{b}}', c='{{c}}')))
define stream InterStream (a string, b string, c string, var string);

from InputStream
select a, b, c, var  
insert into InterStream;

I wish to append var as part of my base URL, which is the publisher url for the http-sink request.

Does siddhi have such a provision?


Solution

  • Yes, it works the same as the query params,

     publisher.url='http://<host>:<port>/{{var}}/parse?a={{a}}&b={{b}}&c={{c}}'