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

天大地大妈咪最大 提交于 2020-01-25 07:57:05

问题


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?


回答1:


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.




回答2:


Please try using the regex for 200 and 400 ranged status with '2**' and '4**' respectively.



来源:https://stackoverflow.com/questions/59406540/unable-to-handle-responses-using-regex-http-status-code-in-siddhi

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!