siddhi

Unable to handle responses using 'regex' http.status.code in Siddhi


Unable to handle responses using, for response 500:

@source(type='http-response', sink.id = 'serviceActivate', http.status.code = '5\d+', @map(type = 'json', @attributes(result = '$.result')))

or

@source(type='http-response', sink.id = 'serviceActivate', http.status.code = '[2|4|5]00', @map(type = 'json', @attributes(result = '$.result')))

I see an error:

[2019-12-19 11:35:06,221] ERROR {org.wso2.extension.siddhi.io.http.source.HttpResponseMessageListener} - No source of type 'http-response' for status code '500' has been defined. Hence dropping the response message.

For multiple source consecutive, without using regexp, no error:

@source(.... http.status.code = '200',.....)
@source(.... http.status.code = '400',.....)
@source(.... http.status.code = '500',.....)

How do I write regexp correctly?


Solution

  • This seems to be due to the bug, WSO2 SP 4.4.0 is based on Siddhi core 4x and is currently not under active development. I tested the above with latest Siddhi Distribution 5.1.2, could not reproduce. See more details on siddhi 5x development here.