The application disconnects

There are several common reasons why an application might disconnect unexpectedly.

Does another application have the same client ID?

If more than one MQTT application uses the same client ID, the applications can disconnect unexpectedly. The first application connects successfully. When another application attempts to connect with the same client ID, the first application is disconnected, and the new application connects. If the applications contain logic to automatically reconnect, the two applications can repeatedly disconnect each other.

Check the default log for messages that indicate that multiple applications are using the same ID. To resolve the problem, ensure that each application has a unique client ID.

Has the KeepAlive parameter on the MQTT ConnectionObject expired?

If the KeepAlive parameter of the MQTT ConnectionObject expires, the application disconnects.

To resolve the problem, you can connect the application again, or adjust the KeepAlive parameter so that the application remains connected to Eclipse Amlen for longer.

Does the messaging policy allow an attempted action?

If the application disconnects after it attempts to publish, subscribe, send, receive, or browse, you might have a messaging policy that does not allow the action. In some cases, attempting the action can cause the application to disconnect.

Check the logs for messages that indicate that the messaging policy does not allow the action. To resolve the problem, change the messaging policy to allow the action. Alternatively, connect the application to an endpoint with messaging policies that allow the action.

Has the messaging user group membership changed?

If you use Eclipse Amlen messaging users and groups in your connection or messaging policies, and you update the group membership of the application user, applications might disconnect and fail to reconnect.

The user and group information is cached when the application connects. If an application is connected when the group membership of the application user is modified, the cache is used until the cache timeout is reached. When the timeout is reached, the new group membership information is used. If the connection policies and messaging policies do not allow the new group membership, the application disconnects and cannot reconnect.

To resolve the problem, check the group membership of the user against the groups that are allowed in the connection and messaging policies. Add the user to the appropriate groups, or update the connection policies and messaging policies to allow the group to connect.

Are MQTT subscribers being disconnected?

The connection that is being used by an MQTT client can be taken over by another MQTT client that is using the same client ID. MQTT clients can be disconnected.

To avoid this problem, you must ensure that all MQTT client IDs are unique. For more information, see MQTT considerations for large-scale public subscription deployments.