coravel icon indicating copy to clipboard operation
coravel copied to clipboard

Broadcast fallback not working with multiple IListener<T>

Open lisandrogreco opened this issue 2 years ago • 2 comments

Describe the bug When a class implements multiple IListener<T> 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 });

lisandrogreco avatar Mar 06 '22 13:03 lisandrogreco

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 🙂

jamesmh avatar Mar 08 '22 13:03 jamesmh

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. :(

hammypants avatar Aug 12 '22 01:08 hammypants