Coder Social home page Coder Social logo

Add an async publisher about easy.messagehub HOT 4 CLOSED

per-ove avatar per-ove commented on July 23, 2024
Add an async publisher

from easy.messagehub.

Comments (4)

NimaAra avatar NimaAra commented on July 23, 2024

Thank you for your interest in the library. Similar issues have been raised around async support. This library is in-memory and there is no IO involved therefore it is synchronous by design. The introduction of async will nullify the performance benefits of using the library.

The fix is simple as I have explained here.

from easy.messagehub.

per-ove avatar per-ove commented on July 23, 2024

As I understand, the publish method are not fire and forget as it not return until all subscriptions are finished.
I know I can fix this when invoking the publish method but it's easier to have a non blocking method in the library.

from easy.messagehub.

NimaAra avatar NimaAra commented on July 23, 2024

This library is meant to be in-memory, CPU bound and therefore synchronous (just like native .NET events) therefore any long running consumer should offload the work as soon as received (which is again the general pattern with .NET events).

You definitely do not want to be creating tasks like you are doing in the proposed snippet; Instead, you can wrap the MessageHub and use System.Threading.Channels which will nicely take care of offloading your publish/subscribe.

from easy.messagehub.

per-ove avatar per-ove commented on July 23, 2024

Thank you for a good answer.

from easy.messagehub.

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.