-
Notifications
You must be signed in to change notification settings - Fork 282
Description
Hi guys!
I obviously have problem understanding the registrations of async handlers and mappers when I have IHostedService that has to build and run the Dispatcher.
So, I have regular service registration in my Worker console project, building IServiceCollection. Here I must .AddBrighter() and register async handlers and mappers explicitly (or use AutoFromAssemblies - which I'd like to avoid btw).
Then, in my IHostedService I'm building up the Dispatcher with CommandProcessorFactory, passing the SubscriberRegistry where I had to register my handlers again, and to the DispatcherBuilder passing another MessageMapper with same map like I had in the service registration in the beginning.
Only if I do the registrations in both places (or use AutoFromAssemblies), the worker starts consuming messages from the bus and instantiating handlers.
I'd really like to avoid redundant registrations if possible.
Please let me know what I'm doing wrong here.
Thanks!
Aleks