Contact Free trial Login

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:
    <ftp:config name="FTP_Config" doc:name="FTP Config" >
      <ftp:connection host="ftp.someftphost.com" port="21" username="myusername" password="mypassword" >
        <reconnection failsDeployment="true" >
          <reconnect count="5"/>
        </reconnection>
      </ftp:connection>
    </ftp:config>
    <flow name="reconnectionsFlow" >
      <ftp:listener doc:name="On New or Updated File" config-ref="FTP_Config">
        <scheduling-strategy >
          <fixed-frequency />
        </scheduling-strategy>
      </ftp:listener>
    </flow>
  • 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:
    <ftp:connection host="ftp.someftphost.com" port="21" username="myusername" password="mypassword" >
      <reconnection>
        <reconnect-forever frequency="4000"/>
      </reconnection>
    </ftp:connection>

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.