Mahesh Sankaran
Mahesh Sankaran

Reputation: 1

WSO2 Stream Processor : Correlation during http response handling for http service calls

I have a hosted http service that accepts a trend data and returns some output. This service is accessed in siddhi query language as follows:

@sink(type='http-request', sink.id='trends', 
publisher.url='${SERVICE_URL}',  @map(type='json', @payload(""" {"trend":{{trendArray}} } """) ) )
define stream Request(item string, trendArray string);

@source(type='http-response' , sink.id='trends', http.status.code='200',
        @map(type='json', @attributes(stock = '<HOW_TO_GET_THIS_VALUE>', output = "<HOW_TO_GET_THIS_VALUE>")
) )
define stream Response(item string, output string);

The http request(and response) payload doesn't include item name.

  1. when the response comes we would like to assign item name against which we scored the output - marked as HOW_TO_GET_THIS_VALUE above. How to accomplish this in siddhi query ?
  2. How to treat the response data of as-is as pass to the field ?

I did not see a description of this scenario in siddhi. If not supported, it will good to know details of a custom extension (based out of http extension) for this scenario. Solution to add a proxy layer for http call is less desired.

Upvotes: 0

Views: 87

Answers (1)

Mahesh Sankaran
Mahesh Sankaran

Reputation: 1

After some experiments , HOW_TO_GET_THIS_VALUE = 'trp:item'. The http sink should also have this field even though its not used in payload.

Upvotes: 0

Related Questions