【发布时间】:2019-01-29 10:46:24
【问题描述】:
是否可以从jdbc-inbound-channel-adapter 捕获异常(例如,查询执行期间数据库出现问题)?
例如。在http-outbound-gateway 中可以使用error-handler 属性声明的错误处理程序。
感谢您的建议。
【问题讨论】:
标签: java jdbc spring-integration
是否可以从jdbc-inbound-channel-adapter 捕获异常(例如,查询执行期间数据库出现问题)?
例如。在http-outbound-gateway 中可以使用error-handler 属性声明的错误处理程序。
感谢您的建议。
【问题讨论】:
标签: java jdbc spring-integration
jdbc-inbound-channel-adapter 完全基于 JdbcPollingChannelAdapter 及其用于“硬”轮询逻辑的 SourcePollingChannelAdapter 包装器。
我很确定您已经为提到的jdbc-inbound-channel-adapter 或全局提供了<poller> 配置。
那个有这个选项:
<xsd:attribute name="error-channel" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[
Identifies channel that error messages will be sent to if a failure occurs in this
poller's invocation. To completely suppress Exceptions, provide a
reference to the "nullChannel" here.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
因此,当轮询 DB 期间出现错误时,它将被包装到 ErrorMessage 并发送到已配置的 error-channel。如果未提供,则将使用全局 errorChannel bean。
有关详细信息,请参阅参考手册中的错误处理章节:https://docs.spring.io/spring-integration/docs/current/reference/html/configuration.html#namespace-errorhandler
【讨论】: