New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added sample of Event Bus with superpowers #78
Conversation
2e7b34f
to
7aa30f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider implementing a query method as well.
async ValueTask<object?> IEventHandler.Handle(object @event, CancellationToken ct) | ||
{ | ||
return await Handle((TEvent)@event, ct); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async ValueTask<object?> IEventHandler.Handle(object @event, CancellationToken ct) | |
{ | |
return await Handle((TEvent)@event, ct); | |
ValueTask<object?> IEventHandler.Handle(object @event, CancellationToken ct) | |
{ | |
return Handle((TEvent)@event, ct); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kbroniek, thank you for the suggestion. This sample is more focused on the Events Broadcast, so publishing events to subscribers. Do you see potential in that? My intent wasn't to replace MediatR, but indeed that approach could also work for any processing 🤔 Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. It will be nice to add a benchmark, but I know it will consume your time that we don't have these days.
Thought you could implement this as .net events or take advantage of source code generation. It could be fast then.
What if we add multiple handlers in the multi-threading app. Consider using ConcurrentDictionary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair points. I added an issue for that: #85. I'll tackle that in a dedicated PR, as this branch is living too long. It's about time to kill it 😉
7aa30f4
to
ca6b578
Compare
List of superpowers: