java - spring 集成报错信息路由是如何工作的?
问题描述
我已经配置了我的 spring 集成应用程序来管理这样的错误:
<exception-type-router resolution-required="true" default-output-channel="errorChannelStop" input-channel="error-manager">
<mapping exception-type="org.springframework.xml.validation.XmlValidationException" channel="formatErrorMessageChannel" />
</exception-type-router>
但是,当我遇到以下异常时,它不会将消息路由到formatErrorMessageChannel
通道:
org.springframework.xml.validation.XmlValidationException: Could not validate source: The element type "messageType" must be terminated by the matching end-tag "</messageType>".;
nested exception is org.xml.sax.SAXParseException; line number: 9; columnNumber: 24; The element type "message Type" must be terminated by the matching end-tag "</messageType>".
...
Caused by: org.xml.sax.SAXParseException: The element type "message Type" must be terminated by the matching end-tag "</messageType>".
为什么 ?
解决方案
您需要确保将消息发送到该error-manager
. 仅仅抛出一个异常并不能使一切都对你的错误通道起作用。
有关更多信息,请参阅文档:https ://docs.spring.io/spring-integration/docs/5.2.3.RELEASE/reference/html/error-handling.html#error-handling
推荐阅读
- python - Django AD 集成获取 AADSTS50011:请求中指定的回复 url 与为应用程序配置的回复 url 不匹配:
- powershell - 如何使用 powershell 设置远程软件安装的安装选项?
- sql - SSRS 表示方差 %
- vba - VBA循环遍历用户窗体中的文本框控件
- c# - C#从派生类访问父类的属性
- java - 使用 JUnit 在 Intellij 上运行特定测试
- .net - 无法在 VS2008 中添加服务参考
- tensorflow - 如何在 Tensorflow 中训练单个类的高特异性?
- angular - 无法将渐变添加到 Angular6 中的 C3 面积样条图
- bigdata - 如何为众多开发者提供大数据仓库的独家副本?