NimaAra / Easy.MessageHub

No need for .NET Events! A thread-safe, high performance & easy to use cross platform implementation of the Event Aggregator Pattern.
MIT License
258 stars 41 forks source link

Support for async actions #25

Closed per-ove closed 1 year ago

per-ove commented 1 year ago

Hi. If one for some reason needs to perform a call to an async method in the action callback. The global errorhandler does not work because no one await the returned task. Is it possible to get support for this? We can probably surround the async method call in our callback with a try/catch but the global handler are more conveniant to use

NimaAra commented 1 year ago

Hi, Thank you for your interest in the library.

There is currently no plan to support async handling in the global handler. The purpose of the global handler is to be light and synchronous.

You can achieve async handling by adding the events to a Channel<T> and have other thread(s) consume them asynchronously.

per-ove commented 1 year ago

Thank you for your answer. I'm happy with that