jamesmh / coravel

Near-zero config .NET library that makes advanced application features like Task Scheduling, Caching, Queuing, Event Broadcasting, and more a breeze!
https://docs.coravel.net/Installation/
MIT License
3.66k stars 242 forks source link

Broadcast fallback not working with multiple IListener<T> #283

Open lisandrogreco opened 2 years ago

lisandrogreco commented 2 years ago

Describe the bug When a class implements multiple IListener the Broadcast fails because the HandleAsync is Ambiguous.

Affected Coravel Feature Events

Expected behavior Possible to use multiple IListerner at the same class

As workaround i changed following line in the Dispatcher.cs From: var result = listenerType.GetMethod("HandleAsync").Invoke(obj, new object[] { toBroadcast }); To: var result = listenerType.GetMethod("HandleAsync", new Type[] {toBroadcast.GetType()}).Invoke(obj, new object[] { toBroadcast });

jamesmh commented 2 years ago

Thanks for this. Yes, this will require some changes to how the internals of the dispatcher work. But this scenario does make sense and I can see why it ought to be supported.

Will update once work has been done 🙂

hammypants commented 1 year ago

Thanks for this. Yes, this will require some changes to how the internals of the dispatcher work. But this scenario does make sense and I can see why it ought to be supported.

Will update once work has been done 🙂

Would it be possible to expose the ability to supply one's own dispatcher (and possible IEventRegistration...) officially? I have the same issue, with the added desire for dynamic registration [and removal]. Possible atm via proxy, but it's a lot of ceremony. :(