NsqSharp icon indicating copy to clipboard operation
NsqSharp copied to clipboard

Support async

Open phillijw opened this issue 6 years ago • 1 comments

The handler interface does not support async implementations. Either add a new async method implementation or replace existing one to return a Task.

Add async wherever else it makes sense as well.

phillijw avatar Sep 20 '19 17:09 phillijw

+1 just stumbled into a situation, where I needed to call async/await code from the HandleMessage callback. It turns out that just creating a Task via calling an async method seems to work in a console app, however I’m not at all sure that this is the correct sync/async transition. Does the code need to wait for completion? What about exceptions? SynchronisationContext? Does it drain the queue and re-queue all messages in the ThreadPool queue? Does it deadlock itself?

Yes, I guess there is need for either a comprehensive example or even better an async compatible message handler.

Lercher avatar Apr 08 '20 16:04 Lercher