wso2siddhistream-processingwso2-streaming-integrator

Unable to handle responses using 'regex' http status codes in Siddhi


I was trying to handle/receive all the responses with the 2xx status codes with the 'regex' http response code '2\d+' but it was not handling it as expected.When I enter the http status code directly (for example '202') then it was handling the response. But I want 'regex' to handle it.

@source(type='http-response', sink.id='Response',http.status.code='2\\d+', @map(type='json',@attributes(success = 'status')))
@sink(type='log')
define stream ResponseStream(success string);

Here is the response am getting when i use regex code.

[2019-11-26 07:16:42,705] ERROR {org.wso2.extension.siddhi.io.http.source.HttpResponseMessageListener} - No source of type 'http-response' that matches with the status code '202' has been defined. Hence dropping the response message.

Kindly help me to handle this using regex codes.


Solution

  • In your Siddhi query you have given status code as '2\\d+'. Please change it to '2\d+'