When a Mule app starts, a connectivity test runs on components, such as the HTTP or FTP connector, that need to connect to an external server and if the test fails the default behavior is to log a warning message and continue with the deployment of the app, instead of blocking the deployment.
You can modify this behavior by setting a number of reconnection attempts to try after an initial failure and by forcing the deployment to fail when all connection attempts fail.
-
Fail Deployment (
failsDeployment
): Forces the deployment to fail if the connection fails and any configured reconection attempts are exhausted. -
Reconnect (
reconnect
): Limits the number of reconnection attempts and the interval at which to execute them. For example, you might set a count of 5 reconnection attempts at afrequency
of every4000
milliseconds (ms). Defaults to 2 reconnection attempts at a frequency of2000ms
. -
Example with that fails after 5 reconnection attempts are exhausted:
<http:request-config name="HTTP_Request_Config" doc:name="HTTP Request Config">
<http:request-conection host="https://jsonplaceholder.typicode.com/posts" port="80" >
<reconnection failsDeployment="true" >
<reconnect frequency="4000" count="5" />
</reconnection
</http:request-connection>
</http:request-config>
-
Reconnect Forever (reconnect-forever): Attempts to reconnect at a given interval, for example, every 4000 ms for as long as the app runs. Defaults to every 2000 ms. Because there is no limit on the number of retries, no value for count is specified.
-
Example that does not set a limit on the number of reconnection attempts:
-
[source,xml]
<http:request-connection host="https://jsonplaceholder.typicode.com/posts" port="80" > <reconnection> <reconnect-forever frequency="4000" count=”5”/> </reconnection> </http:request-connectio>