1

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.

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

I have given it as '2\\d+' (two backward slashes) ... The siddhi query documentation also has the same... Anyways let me try your suggestion...
Yes, I have edited my comment to have 2 backslashes. Did using single backslash solve your issue? This lapse in documentation will be fixed

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.