Blocking="false" is not working in JDBC Reconnection in 3.4.2

303 views Asked by At

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>
2

There are 2 answers

0
Sudarshan On

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 :)

0
jvas On

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.