Nav

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 (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 a frequency of every 4000 milliseconds (ms). Defaults to 2 reconnection attempts at a frequency of 2000 ms.

    Example with that fails after 5 reconnection 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 4000 ms for as long as the app runs. Defaults to every 2000 ms.

    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>

In this topic: