无法在 Siddhi 中使用 'regex' http.status.code 处理响应
Unable to handle responses using 'regex' http.status.code in Siddhi
无法处理使用响应 500 的响应:
@source(type='http-response', sink.id = 'serviceActivate', http.status.code = '5\d+', @map(type = 'json', @attributes(result = '$.result')))
或
@source(type='http-response', sink.id = 'serviceActivate', http.status.code = '[2|4|5]00', @map(type = 'json', @attributes(result = '$.result')))
我看到一个错误:
[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.
对于多个源连续,不使用正则表达式,没有错误:
@source(.... http.status.code = '200',.....)
@source(.... http.status.code = '400',.....)
@source(.... http.status.code = '500',.....)
如何正确编写正则表达式?
这似乎是由于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,无法重现。
查看更多关于 siddhi 5x 开发的详细信息 here。
请尝试将正则表达式分别用于“2**”和“4**”的 200 和 400 范围状态。
无法处理使用响应 500 的响应:
@source(type='http-response', sink.id = 'serviceActivate', http.status.code = '5\d+', @map(type = 'json', @attributes(result = '$.result')))
或
@source(type='http-response', sink.id = 'serviceActivate', http.status.code = '[2|4|5]00', @map(type = 'json', @attributes(result = '$.result')))
我看到一个错误:
[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.
对于多个源连续,不使用正则表达式,没有错误:
@source(.... http.status.code = '200',.....)
@source(.... http.status.code = '400',.....)
@source(.... http.status.code = '500',.....)
如何正确编写正则表达式?
这似乎是由于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,无法重现。 查看更多关于 siddhi 5x 开发的详细信息 here。
请尝试将正则表达式分别用于“2**”和“4**”的 200 和 400 范围状态。