About Reconnection Strategies
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. 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 reconnection attempts are exhausted.
reconnect): Limits the number of reconnection attempts and the interval at which to execute them. For example, you might set a
5reconnection attempts at a
4000milliseconds (ms). Defaults to
2reconnection attempts at a frequency of
2000ms.Example with that fails after
5reconnection attempts are exhausted:
1 2 3 4 5 6 7
<http:request-config name="HTTP_Request_Config" doc:name="HTTP Request Config"> <http:request-connection 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
4000ms for as long as the app runs. Defaults to every
2000ms.Example that does not set a limit on the number of reconnection attempts:
1 2 3 4 5
<http:request-connection host="https://jsonplaceholder.typicode.com/posts" port="80" > <reconnection> <reconnect-forever frequency="4000"/> </reconnection> </http:request-connection>