将文本消息转换为 o Siddhi 事件时出现 WSO2 错误

WSO2 error when converting Text message to o Siddhi Event

我正在使用 WSO2SP 版本 4.3.0 正则表达式扩展名:siddhi-execution-regex-4.1.2.jar .我的代码工作正常,但每当我重新启动我的 wso2sp 实例时,我开始收到错误“在 siddhi 文本输入映射器的流事务流 1 中将文本消息转换为 Siddhi 事件时发生异常。java.lang.WhosebugError” 我必须多次重启 wso2sp 才能使其正常工作,这不是一个可行的解决方案。我还使用扩展名 siddhi-io-http-1.0.40.jar 通过 http 发送短信。文本地图扩展:siddhi-map-text-1.1.2.jarsiddhi-map-text-1.0.22.jar

测试来源:

@source(type = 'http', receiver.url = 'http://localhost:5005/text',
@map(type='text',fail.on.missing.attribute='false', regex.A=""""(after)":("(\"|[^"])*"|\[("(\"|[^"])*"(,"(\"|[^"])*")*)?\])""",
                @attributes(payload = 'A[2]')))
define stream transactionstream1(payload string); 

测试文本:

curl -X POST \
    http://localhost:5005/text \
    -H 'content-type: application/json' \
 -d '{"schema":{"type":"struct","fields":[{"type":"string","optional":false,"field":"id"}],"optional":false,"name":"db.db.Key"},"payload":{"id":"{ \"$oid\" : \"dafeafwe3\"}"}} {"schema":{"type":"struct","fields":[{"type":"string","optional":true,"name":"io.debezium.data.Json","version":1,"field":"after"},{"type":"string","optional":true,"name":"io.debezium.data.Json","version":1,"field":"patch"},{"type":"struct","fields":[{"type":"string","optional":false,"field":"version"},{"type":"string","optional":false,"field":"connector"},{"type":"string","optional":false,"field":"name"},{"type":"int64","optional":false,"field":"ts_ms"},{"type":"string","optional":true,"name":"io.debezium.data.Enum","version":1,"parameters":{"allowed":"true,last,false"},"default":"false","field":"snapshot"},{"type":"string","optional":false,"field":"db"},{"type":"string","optional":false,"field":"rs"},{"type":"string","optional":false,"field":"collection"},{"type":"int32","optional":false,"field":"ord"},{"type":"int64","optional":true,"field":"h"}],"optional":false,"name":"io.debezium.connector.mongo.Source","field":"source"},{"type":"string","optional":true,"field":"op"},{"type":"int64","optional":true,"field":"ts_ms"}],"optional":false,"name":"db.db.collection.Envelope"},"payload":{"after":"{\"_id\": {\"$oid\": \"54444342fdsfsdfs\"},\"code\": \"42432432423\",\"name\": \"name1\",\"desc\": \"description\",\"transRefId\": \"cgvvjbjhvjy6979yjbv\",\"origAmount\": 1000,\"amount\": 1000,\"currency\": \"USD\",\"redeemedCashcode\": \"\",\"sender\": {\"id\": \"342edesfsfes\",\"name\": \"rose\",\"phone\": \"123456789\"},\"receiver\": {\"id\": \"fr3wfwrw342\",\"name\": \"daass\",\"phone\": \"453452423\",\"client\": \"CLIENT2\"}}}'

堆栈跟踪的一部分:

ERROR {org.wso2.extension.siddhi.map.text.sourcemapper.TextSourceMapper}Exception occurred when converting Text message {"type":"string","optional":false,"field":"id"}],"optional":false,"name":"db.db.Key"},"payload":{"id":"{ \"$oid\" : \"dafeafwe3\"}"}}   {"schema":{"type":"struct","fields":[{"type":"string","optional":true,"name":"io.debezium.data.Json","version":1,"field":"after"},{"type":"string","optional":true,"name":"io.debezium.data.Json","version":1,"field":"patch"},{"type":"struct","fields":[{"type":"string","optional":false,"field":"version"},{"type":"string","optional":false,"field":"connector"},{"type":"string","optional":false,"field":"name"},{"type":"int64","optional":false,"field":"ts_ms"},{"type":"string","optional":true,"name":"io.debezium.data.Enum","version":1,"parameters":{"allowed":"true,last,false"},"default":"false","field":"snapshot"},{"type":"string","optional":false,"field":"db"},{"type":"string","optional":false,"field":"rs"},{"type":"string","optional":false,"field":"collection"},{"type":"int32","optional":false,"field":"ord"},{"type":"int64","optional":true,"field":"h"}],"optional":false,"name":"io.debezium.connector.mongo.Source","field":"source"},{"type":"string","optional":true,"field":"op"},{"type":"int64","optional":true,"field":"ts_ms"}],"optional":false,"name":"db.db.collection.Envelope"},"payload":{"after":"{\"_id\": {\"$oid\": \"54444342fdsfsdfs\"},\"code\": \"42432432423\",\"name\": \"name1\",\"desc\": \"description\",\"transRefId\": \"cgvvjbjhvjy6979yjbv\",\"origAmount\": 1000,\"amount\": 1000,\"currency\": \"USD\",\"redeemedCashcode\": \"\",\"sender\": {\"id\": \"342edesfsfes\",\"name\": \"rose\",\"phone\": \"123456789\"},\"receiver\": {\"id\": \"fr3wfwrw342\",\"name\": \"daass\",\"phone\": \"453452423\",\"client\": \"CLIENT2\"}}},"op":"r","ts_ms":1575862492251}} to Siddhi Event in the stream transactionstream1 of siddhi text input mapper. java.lang.WhosebugError
    at java.util.regex.Pattern$Branch.match(Pattern.java:4606)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
    at java.util.regex.Pattern$Loop.match(Pattern.java:4787)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4719)
    at java.util.regex.Pattern$BranchConn.match(Pattern.java:4570)
    at java.util.regex.Pattern$CharProperty.match(Pattern.java:3779)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4606)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
    at java.util.regex.Pattern$Loop.match(Pattern.java:4787)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4719)
    at java.util.regex.Pattern$BranchConn.match(Pattern.java:4570)
    at java.util.regex.Pattern$CharProperty.match(Pattern.java:3779)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4606)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
    at java.util.regex.Pattern$Loop.match(Pattern.java:4787)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4719)
    at java.util.regex.Pattern$BranchConn.match(Pattern.java:4570)
    at java.util.regex.Pattern$CharProperty.match(Pattern.java:3779)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4606)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
    at java.util.regex.Pattern$Loop.match(Pattern.java:4787)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4719)
    at java.util.regex.Pattern$BranchConn.match(Pattern.java:4570)
    at java.util.regex.Pattern$CharProperty.match(Pattern.java:3779)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4606)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
    at java.util.regex.Pattern$Loop.match(Pattern.java:4787)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4719)
    at java.util.regex.Pattern$BranchConn.match(Pattern.java:4570)
    at java.util.regex.Pattern$CharProperty.match(Pattern.java:3779)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4606)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
    at java.util.regex.Pattern$Loop.match(Pattern.java:4787)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4719)
    at java.util.regex.Pattern$BranchConn.match(Pattern.java:4570)
    at java.util.regex.Pattern$Slice.match(Pattern.java:3974)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4606)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
    at java.util.regex.Pattern$Loop.match(Pattern.java:4787)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4719)
    at java.util.regex.Pattern$BranchConn.match(Pattern.java:4570)
    at java.util.regex.Pattern$CharProperty.match(Pattern.java:3779)
    at java.util.regex.Pattern$Branch.match(Pattern.java:4606)
    at java.util.regex.Pattern$GroupHead.match(Pattern.java:4660)
    at java.util.regex.Pattern$Loop.match(Pattern.java:4787)
    at java.util.regex.Pattern$GroupTail.match(Pattern.java:4719)

是否存在版本兼容问题?我该如何永久解决这个问题?

似乎这种行为与 Java 在某些存在潜在回溯问题的情况下臭名昭著的不喜欢交替有关。

所以,这部分 ("(\"|[^"])"|[("(\"|[^"])"(,"(\ "|[^"])"))?])" 对回溯机制造成撤销负担。

请尝试按以下方式更新正则表达式,以减少导致 WhosebugError.

的实施缺陷的影响
(after)":("(\"|[|]|[^"])*+")

详情请参考