Skip to content
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

VCST-430: Simplify event handlers registration #2769

Merged
merged 14 commits into from
Mar 13, 2024
Merged

VCST-430: Simplify event handlers registration #2769

merged 14 commits into from
Mar 13, 2024

Conversation

artem-dudarev
Copy link
Contributor

@artem-dudarev artem-dudarev commented Mar 4, 2024

Description

Before

var handlerRegistrar = appBuilder.ApplicationServices.GetService<IHandlerRegistrar>();
handlerRegistrar.RegisterHandler<UserChangedEvent>(async (message, token) => await appBuilder.ApplicationServices.GetService<LogChangesUserChangedEventHandler>().Handle(message));

After

appBuilder.RegisterEventHandler<UserChangedEvent, LogChangesUserChangedEventHandler>();

Also, now it's possible to register a handler for all event types:

appBuilder.RegisterEventHandler<DomainEvent, AllEventsHandler>();

Note

If you register an event handler for UserChangedEvent, this handler will receive UserChangedEvent and all events derived from UserChangedEvent.

References

QA-test:

Jira-link:

https://virtocommerce.atlassian.net/browse/VCST-430

Artifact URL:

@OlegoO OlegoO requested a review from ksavosteev March 5, 2024 09:57
Copy link

@artem-dudarev artem-dudarev merged commit e8ba03a into dev Mar 13, 2024
10 checks passed
@artem-dudarev artem-dudarev deleted the VCST-430 branch March 13, 2024 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants