Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed subscription restore from client state when mqtt client reconnects #4189

Merged
merged 8 commits into from
Feb 22, 2021

Conversation

vipeller
Copy link
Contributor

@vipeller vipeller commented Jan 8, 2021

When an MQTT client used persistent session, the previous subscriptions did not get restored. If the same client connected to IoTHub directly, its subscriptions (e.g. for receiving twin responses) would have been restored.
In case of c# sdk it would not be a problem, because the sdk automatically resubscribes when it is able to restore the connection to edgeHub.

In case of python sdk however this does not happen. As a result, if a device connects using the python sdk and edgeHub gets restarted, the client will not be receiving m2m messages, twin patches, etc anymore.

The fix seems big but the main code in "MessagingServiceClient.cs", the rest is just the result of a changed interface and some plumbing.

varunpuranik
varunpuranik previously approved these changes Jan 10, 2021
Copy link
Contributor

@varunpuranik varunpuranik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good. I am just concerned about all the async calls from sync context. Might be better to make it all async (with Tasks), and then call it from an async void method.

@kodiakhq kodiakhq bot merged commit 7e2d191 into Azure:master Feb 22, 2021
@vipeller vipeller deleted the vipeller/mqtt_resubscribe_fix branch March 23, 2021 21:59
vipeller added a commit to vipeller/iotedge that referenced this pull request May 27, 2021
kodiakhq bot pushed a commit that referenced this pull request May 28, 2021
…cts (#5048)

Cherry picked (#4189)

When an MQTT client used persistent session, the previous subscriptions did not get restored. If the same client connected to IoTHub directly, its subscriptions (e.g. for receiving twin responses) would have been restored.
In case of c# sdk it would not be a problem, because the sdk automatically resubscribes when it is able to restore the connection to edgeHub.

In case of python sdk however this does not happen. As a result, if a device connects using the python sdk and edgeHub gets restarted, the client will not be receiving m2m messages, twin patches, etc anymore.

The fix seems big but the main code in "MessagingServiceClient.cs", the rest is just the result of a changed interface and some plumbing.
damonbarry pushed a commit to damonbarry/iotedge that referenced this pull request Apr 15, 2022
…cts (Azure#4189)

When an MQTT client used persistent session, the previous subscriptions did not get restored. If the same client connected to IoTHub directly, its subscriptions (e.g. for receiving twin responses) would have been restored.
In case of c# sdk it would not be a problem, because the sdk automatically resubscribes when it is able to restore the connection to edgeHub.

In case of python sdk however this does not happen. As a result, if a device connects using the python sdk and edgeHub gets restarted, the client will not be receiving m2m messages, twin patches, etc anymore.

The fix seems big but the main code in "MessagingServiceClient.cs", the rest is just the result of a changed interface and some plumbing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants