我有一个spring集成应用程序,可以处理队列中的消息并将它们发送到不同的队列。只要XML是有效的,它对所有预期的消息类型都很有效。我定义了一个错误通道来处理异常情况,如验证失败、路由失败等。
对于错误测试,我插入了一个带有不匹配标记的坏XML消息来测试错误处理。不幸的是,我在eclipse的控制台中得到的输出如下:
[Fatal Error] :1:156: The end-tag for element type "Header" must end with a '>' delimiter它不会将消息路由到错误流,在错误流中,状态将从挂起更新为错误。
看起来Spring Integration本身无法处理这种情况。我预计会发生异常,并让它将消息路由到定义的错误通道。
任何帮助都将不胜感激。
我们运行的是Spring Integration 2.2.4,我尝试了2.2.6,得到了同样的结果。我们正在使用的公司框架就在该版本上。我们正在尝试让他们更新到最新版本,但这还没有发生。
发布于 2014-07-17 05:40:09
看起来您尝试手动构建一个XML Document并将其发送到<int-xml:validating-filter>。
当我使用:
return builder.newDocumentBuilder().parse(
new InputSource(new StringReader("<greeting><other</greeting>")));我的结论是:
[Fatal Error] :1:17: Element type "other" must be followed by either attribute specifications, ">" or "/>".这意味着你甚至不能创建一个Document,并且仍然不能谈论validation。
尝试将无效xml的字符串发送到验证器通道。在本例中,我得到:
org.springframework.messaging.MessageHandlingException: org.springframework.xml.validation.XmlValidationException: Could not validate source: Element type "other" must be followed by either attribute specifications, ">" or "/>".; nested exception is org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 17; Element type "other" must be followed by either attribute specifications, ">" or "/>".这意味着我可以处理来自某个upstrem error-channel的MessageHandlingException
https://stackoverflow.com/questions/24788511
复制相似问题