1

I am currently upgrading Nservicebus from version 4 to version 7. The application is written in c#. It seems that we can convert the existing synch handler to async handler in the new version of Nservicebus. what will be the advantage of changes to asynch. Can I handle multiple request at same time?. There are lot of handlers in one subscriber project. Some handler will perform Database update and some will perform database update and service call. Currently handler having lot of sync methods that will perform these operations. I am afraid whether I will face any issue if I move to production with these code

  • 1
    Do you perform any I/O bound or blocking work? – ColinM Feb 25 '20 at 23:43
  • It's worth reiterating the following warning from [NService's documentation](https://docs.particular.net/nservicebus/handlers/async-handlers): "It is difficult to give generic advice on how asynchronous code should be structured. It is important to understand compute-bound vs. I/O-bound operations and avoid copying and pasting snippets without analysing the benefits they provide for a given business scenarios. Don't assume; measure it." – Jeremy Caney Feb 25 '20 at 23:43
  • "What are the advantages of async operations" is a _very_ general question, and the _very_ general answer is "the CPU doesn't need to wait for something that isn't CPU bound" - but async is _not_ about concurrency, at its core. I suggest Googling [other questions](https://stackoverflow.com/questions/37419572/if-async-await-doesnt-create-any-additional-threads-then-how-does-it-make-appl), and potentially coming back ans asking something _specific_ about NServiceBus if you have further questions – Preston Guillot Feb 25 '20 at 23:46
  • The advantages depend on what you are doing, since you don't have time to mention all of the uses cases and implementations, it makes this question is dead in the water. Even if you could, such questions are too-broad and could potentially be opinionated. – TheGeneral Feb 26 '20 at 00:05
  • There are lot of handlers in one subscriber project. Some handler will perform Database update and some handler will perform database update and service call. Currently handler having lot of sync methods that will perform these operations. I am afraid whether I will face any issue if I move to production with these code. – DealZaap India Feb 26 '20 at 17:43

1 Answers1

1

Version 6 of NServiceBus moved to the "full async" API. In other words no matter what your logic inside the handlers is you will need to convert your code to align with the new API.

I would encourage you to read version 5 to 6 upgrade guide for a detailed explanation of the changes made and instructions on how to migrate your code.

Migrating from version 4 to 7 includes upgrading by more than one version. In such cases, it's advised to migrate in a stepwise manner one version at a time.

You can find upgrades for each pair of versions in the documentation site I've linked.