-
-
Notifications
You must be signed in to change notification settings - Fork 80
Mqttnet 4 #721
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
Mqttnet 4 #721
Conversation
Bumps [MQTTnet](https://github.com/dotnet/MQTTnet) from 3.1.2 to 4.0.1.184. - [Release notes](https://github.com/dotnet/MQTTnet/releases) - [Commits](dotnet/MQTTnet@v3.1.2...v4.0.1.184) --- updated-dependencies: - dependency-name: MQTTnet dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
1. IMqttFactory removed so substituted an internal version that is only called in our `UseNetDaemonMqttEntityManagement` DI setup method 2. Multiple `MQTTnet.*` namespaces collapsed to fewer 3. PublishAsync() is now EnqueueAsync() 4. EnqueueAsync() does not support a CancellationToken and does not return a success / fail status 5. UseApplicationMessageReceivedHander() has been replaced with event subscriptions `OnMessageReceivedAsync` 6. Managed Mqtt Client connection/disconnection have changed from delegates to events
Codecov Report
@@ Coverage Diff @@
## dev #721 +/- ##
==========================================
+ Coverage 79.44% 79.60% +0.16%
==========================================
Files 137 138 +1
Lines 3503 3516 +13
Branches 356 356
==========================================
+ Hits 2783 2799 +16
+ Misses 576 573 -3
Partials 144 144
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
Man they really messed this one up. Removng the IMqttFactory was a weird one! I will try to review it but even better try to test it too. |
helto4real
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no suggestions for changes. Good job with this But I would want someone to test it manually before I merge this. I will try to find time this weekend.
| /// MqttNet removed the IMqttFactory interface at v4 which breaks our DI | ||
| /// So this is a factory for the MqttFactory to satisfy our use case | ||
| /// </summary> | ||
| internal class MqttFactoryFactory : IMqttFactory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sad that they removed the IMqttFactory interface. This is the way we can deal with it and still use DI.
helto4real
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not find time to test manually but code looks good to me.
* Bump MQTTnet from 3.1.2 to 4.0.1.184 Bumps [MQTTnet](https://github.com/dotnet/MQTTnet) from 3.1.2 to 4.0.1.184. - [Release notes](https://github.com/dotnet/MQTTnet/releases) - [Commits](dotnet/MQTTnet@v3.1.2...v4.0.1.184) --- updated-dependencies: - dependency-name: MQTTnet dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Support MqttNet v4: 1. IMqttFactory removed so substituted an internal version that is only called in our `UseNetDaemonMqttEntityManagement` DI setup method 2. Multiple `MQTTnet.*` namespaces collapsed to fewer 3. PublishAsync() is now EnqueueAsync() 4. EnqueueAsync() does not support a CancellationToken and does not return a success / fail status 5. UseApplicationMessageReceivedHander() has been replaced with event subscriptions `OnMessageReceivedAsync` 6. Managed Mqtt Client connection/disconnection have changed from delegates to events Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Tomas Hellström <tomas.hellstrom@yahoo.se>
Support MqttNet v4
Non-breaking change
Proposed change
Based on
dependabot/nuget/MQTTnet-4.0.1.184branchUseNetDaemonMqttEntityManagementDI setup methodMQTTnet.*namespaces collapsed to fewerOnMessageReceivedAsyncThe public interfaces to the
IMQTTEntityManagerare unchanged so there should be no updates to client code required.[ugliness warning] The upstream library retains
MqttFactorybut deletedIMqttFactory. To make things even more challenging they sealedMqttFactory...So I have created our own
IMqttFactoryto retain current workflow, however there is now a new class calledMqttFactoryFactory, which calls into the originalMqttFactoryto create the client. It's an ugly name but is descriptive(!) and is internal to the extension so users shouldn't see it.Open to alternative suggestions though!
Type of change
Additional information
Checklist
addedupdated to verify that the new code works.If user exposed functionality or configuration variables are added/changed: