mhinze / ShortBus

In-process mediator with low-friction API
MIT License
210 stars 41 forks source link

async methods and implementation #7

Closed mhinze closed 10 years ago

mhinze commented 10 years ago

open for comments.. @mxmissile?

mxmissile commented 10 years ago

looks good, sent you a PR with an Example test, your probably going to have to add it manually to the project if you decide to merge it, I only have VS 2013 and didnt want to muck up your project file with all the new crap

mhinze commented 10 years ago

@mxmissile thanks!

mhinze commented 10 years ago

This is pretty self explanatory, but I updated some sample client code.

https://gist.github.com/mhinze/7551259

mattscully commented 10 years ago

Would it be worth considering adding marker interfaces IAsyncCommand and IAsyncQuery so that clients of the Mediator know whether to call the async Send/Request method or not for a given query? My concern is that for a given query/command, the client would not know which method to invoke on the mediator--and invoking the wrong one will fail. If a given query/command supports both async and synchronous, then the message and the handler will need to implement both interfaces indicating such.

I would also suggest that the async handler interfaces Handle method be renamed to HandleAsync. In addition to following the async naming conventions, this will keep the reflection clean in the mediator in the case where a given handler implements both versions.

mhinze commented 10 years ago

@mattscully Adding the new markers doesn't take away anything, and enables a migration path to async. My only concern is adding to the concept count. Good call also on HandleAsync

mhinze commented 10 years ago

http://www.nuget.org/packages/ShortBus/2.2.37-beta