Blocking=“false” is not working in JDBC Reconnection in 3.4.2

亡梦爱人 提交于 2019-12-11 19:26:02

问题


In JDBC Reconnection strategy implemented blocking as false.. so when we try to deploy the application, even though JDBC connection fails applicaion should be deployed.But Application is not getting deployed in server.

Following is the xml code

<jdbc-ee:connector name="FTPDatabase" dataSource-ref="MySQL_FTP_Data_Source"
        validateConnections="true" queryTimeout="-1" pollingFrequency="0"
        doc:name="Database">
        <reconnect blocking="false" frequency="10000" count="3"/>
    </jdbc-ee:connector>

回答1:


In my opinion this is not possible in a OOTB Mule application. The main reason being the manner in which Mule handles exceptions.

What you are facing is a System Exception.

System Exceptions

Mule invokes a System Exception Strategy when an exception is thrown at the system-level (i.e., when no message is involved, exceptions are handled by system exception strategies). For example, system exception strategies handle exceptions that occur:

during application start-up when a connection to an external system fails When a system exception strategy occurs, Mule sends an exception notification to registered listeners, logs the exception, and — if the exception was caused by a connection failure — executes the reconnection strategy. System Exception Strategies are not configurable in Mule

You can read more about Mule's error handling here

I guess the designers were of the opinion that if you have a DB connector, the DB will be accessible when the Mule application starts up, and in many ways this is a good feature instead of failing silently, it fails loud and fails fast :)




回答2:


Instead of reconnecting 3 times, please try the reconnecting forever option. <reconnect-forever blocking="false" frequency="120000" />. This way whenever the database connection comes back up, it should be successful.



来源:https://stackoverflow.com/questions/30955266/blocking-false-is-not-working-in-jdbc-reconnection-in-3-4-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!