GithubHelp home page GithubHelp logo

Comments (1)

dili91 avatar dili91 commented on June 14, 2024 3

I was able to spend more time on this along with other engineers, and we think we finally found an explanation for the above differences:

When using the AdvancedBusExtensions overload that uses the delegate, a Task is declared as return type but there’s nothing really forcing the implementation to be async. You can have a delegate that does no async, and still not have compilation errors (just a self explanatory warning as in the screenshot):

Screenshot 2024-02-08 at 16 03 18

So, in order for the task to be actually returned, all the (blocking) code which is included in your consumer has to execute.
If what you’re doing there is time-consuming, then you’ll face significant issues, due to single messages “blocking” the ones already prefecthed.

The other - very similar - overloaded method that I’ve used in one of my test in the Gist has an Action<ReadOnlyMemory<byte>, MessageProperties, MessageReceivedInfo> parameter that describes the handler, and that gets internally wrapped into a task! This is the reason why, even if the consumer does purely blocking stuff, that is still offloaded to a worker thread and we see concurrent consuming.

Having this behavior clear in mind, I'm happy closing the issue. ✅

With that said, I personally think it would be worth capturing this subtle difference somehow on the extension class, using slightly different signature names and/or improving the documentation.

from easynetq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.