You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implementing reconnect mechanism when network was offline, invoking ProvisioningDeviceClient.registerDevice() throws ProvisioningDeviceConnectionException with message "Open called on an already open connection".
if (this.mqttConnection != null && !this.mqttConnection.isMqttConnected())
{
throw new ProvisioningDeviceConnectionException("Open called on an already open connection");
}
should it not state instead?
if (this.mqttConnection != null && this.mqttConnection.isMqttConnected())
{
throw new ProvisioningDeviceConnectionException("Open called on an already open connection");
}
Also, closing the client does not null the field mqttConnection (which would help with the above logic), so apparently, the only solution is to throw away the client when we know that there was a disconnect?
Context
Description of the issue
Implementing reconnect mechanism when network was offline, invoking ProvisioningDeviceClient.registerDevice() throws ProvisioningDeviceConnectionException with message "Open called on an already open connection".
Code sample exhibiting the issue
see https://github.com/Azure/azure-iot-sdk-java/blob/main/provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/contract/mqtt/ContractAPIMqtt.java#L161
Code states:
should it not state instead?
Also, closing the client does not null the field mqttConnection (which would help with the above logic), so apparently, the only solution is to throw away the client when we know that there was a disconnect?
https://github.com/Azure/azure-iot-sdk-java/blob/main/provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/internal/contract/mqtt/ContractAPIMqtt.java#L208
So apparently, ProvisioningDeviceClient is not intended to be re-used for multiple invocations of
registerDevice
at all, if it seems?Console log of the issue
n/a
The text was updated successfully, but these errors were encountered: