问题描述
我有一个 Mule 应用程序,其中包含许多执行各种操作的流程.其中一个流连接到外部 MySQL 数据库以检索信息.如果与该数据库的连接失败,我的 Mule 应用程序将无法启动,并且我的其他非错误流都不会启动.
I have a Mule application with a number of flows all performing various operations. One of these flows connects to an external MySQL database to retrieve information. If the connection to this database fails, my Mule application fails to start and none of my other, non-erroneous, flows start.
如果连接失败或出现其他错误,我是否可以将 Mule 配置为恢复到连接到外部数据库的流的异常策略,以便所有其他流正常运行?
Is there a way I can configure Mule to revert to the exception strategy of the flow connecting to the external DB in the event that the connection fails or there is some other error so that all other flows will run as normal?
推荐答案
在您的全局 jdbc 连接器上,设置重新连接策略并将 blocking 属性配置为 false.示例:
On your global jdbc connector, set a reconnection strategy and configure the blocking attribute to false. Example:
<jdbc:connector name="mysql">
<reconnect-forever blocking="false" />
</jdbc:connector>
这将阻止连接异常阻止您的 Mule 应用程序,并应允许您其他不依赖连接器的流程正常工作.
This will stop the connection exceptions from blocking your Mule app and should allow you other flows that don't rely on the connector to work as normal.
更多关于重新连接策略的信息:http://www.mulesoft.org/documentation/display/current/Configuring+Reconnection+Strategies
More on reconnection strategies here: http://www.mulesoft.org/documentation/display/current/Configuring+Reconnection+Strategies
这篇关于Mule - 在单流中的 MySQL 连接失败的情况下阻止所有流关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!