question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Upgrade-Guide from 2.8.5 to 3.0.0

See original GitHub issue

As you updated your NuGet package yesterday, I updated it today in my application.

There are some major changes, where I’m not sure how to modify my code correctly.

A upgrade guide in your wiki would be very helpful (starting with your “BREAKING CHANGES”).

As for me: How to update from client.Disconnected += async (sender, args) { /* stuff to do when disconnected */ }; to your new client.DisconnectedHandler ?

… and why did you remove the good old style of the subscriptionresult.failure ?

Thanks so far

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15

github_iconTop GitHub Comments

3reactions
chkr1011commented, May 8, 2019

The reason is that event handlers are not fully compatible with async. So having them in the first place was wrong. The new approach is fully compatible with async. The new approach gives you 3 different ways on handling events.

  1. Implement the required interface of a handler in your own class. You can do whatever you want. You can access fields. Inject stuff etc.
  2. If you don’t need that and your handler is basically a one-liner you can use the “Delegate” classes which accept a async function.
  3. If you don’t have async code you can still use the “Delegate” class because it also supports a not async method (Action instead of Func).

This gives you some flexibility. If you want to call multiple handlers you have to implement this on your own (create a new class and implement the required interface). This also allows you to deal with special use cases like stopping the event handler chain if one call fails or move data from the first handler to another one. This was all impossible when using event handlers.

2reactions
chkr1011commented, May 6, 2019

Hi, basically some new namespaces were introduced. Visual Studio or Resharper should be able to import them properly.

For an example for handlers please read the Wiki. At the moment I have to time to put an upgrade guide together. Probably within the next days or weeks.

SubscriptionResult.Failure is now UnspecifiedError. This comes from new MQTTv5 specification where this value is renamed to the new value. So I had to decide to rely on Failure or move to UnspecifiedError. The strategy of this library is to provide a uniform API over MQTTv3.1 MQTTv3.1.1 and MQTTv5.0.0. So it becomes _UnspecifiedError now.

Best regards Christian

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade-Guide from 2.8.5 to 3.0.0 · Issue #614
A upgrade guide in your wiki would be very helpful (starting with your "BREAKING CHANGES"). As for me: How to update from client.Disconnected...
Read more >
Upgrading Spring Boot
Instructions for how to upgrade from earlier versions of Spring Boot are provided on the project wiki. Follow the links in the release...
Read more >
Upgrading from 2.x to 3.0 - Getting Started
This document details the changes made between 2.x and 3.0 that may affect upgrades. It's not a full list of all changes (see...
Read more >
Migrating AWS Glue for Spark jobs to AWS Glue version 3.0
This topic describes the changes between AWS Glue versions 0.9, 1.0, 2.0 and 3.0 to allow you to migrate your Spark applications and...
Read more >
Chapter: Upgrade to Cisco DNA Center 2.3.3.7
Cisco DNA Center Upgrade Guide ... If you are upgrading either a 44- or 56-core appliance to Cisco DNA Center 2.3.3.7, you have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found