The advanced connection configuration enables the user to configure timeouts and reconnection options.
The example is for MQTT5, but the same properties apply for MQTT3
<mqtt:config name="MQTT5"> <mqtt:mqtt5-connection host="test.mosquitto.org" keepAlive="10" connectTimeout="10"> <reconnection failsDeployment="true"> <reconnect frequency="2000" count="2"/> </reconnection> </mqtt:mqtt5-connection> </mqtt:config>
Time interval in which the client sends a ping to the broker if no other MQTT packets are sent during this period of time. It is used to determine if the connection is still up. the Keep Alive Unit property qualifies the Keep Alive attribute
The timeout between sending the Connect and receiving the ConnAck message. The Connect Timeout Unit property qualifies the Connect Timeout attribute
Mule provide out-of-the-box reconnection strategies to be applied to all connectors that work with connections.
When an operation in a fails to connect to the broker, the default behavior is for the operation to fail immediately and return a connectivity error.
This default behavior can be modified by configuring a reconnection strategy for the operation.
You can configure a reconnection strategy for an operation either by modifying the operation properties or by modifying the connection configuration (this case).
When the application is deployed, a connectivity test is performed on all connectors. If set to true, deployment fails if the test doesn’t pass after exhausting the associated reconnection strategy
Defines the reconnection strategy to use: None, Standard or Forever
Is the default behavior, which immediately returns a connectivity error if the attempt to connect is unsuccessful
- Standard (reconnect)
Sets the number of reconnection attempts and the interval at which to execute them before returning a connectivity error
- Forever (reconnect-forever)
Attempts to reconnect continually at a given interval