You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having both of these overloads to register a handler makes some proposed new features harder:
WithMessageHandler<T>(IHandlerAsync<T>handler)where T : Message;WithMessageHandler<T>(IHandlerResolverhandlerResolver)where T : Message;
The first can't be used with any system that passes transient data to the handler instance constructor.
A new handler instance each time seems safer in general, otherwise it requires handler authors coding for re-entrancy, and all dependencies being long-lived, which is all not obvious.
Describe the solution you'd like
Remove the overload that takes a handler instance.
It is used in tests, but a dummy IHandlerResolver that only returns a supplied instance could be used instead there.
Additional context
Considered as useful for some kind of message context accessor injected into handler constructor.
The text was updated successfully, but these errors were encountered:
Having both of these overloads to register a handler makes some proposed new features harder:
The first can't be used with any system that passes transient data to the handler instance constructor.
A new handler instance each time seems safer in general, otherwise it requires handler authors coding for re-entrancy, and all dependencies being long-lived, which is all not obvious.
Describe the solution you'd like
Remove the overload that takes a
handler
instance.It is used in tests, but a dummy
IHandlerResolver
that only returns a supplied instance could be used instead there.Additional context
Considered as useful for some kind of message context accessor injected into handler constructor.
The text was updated successfully, but these errors were encountered: