-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Introduce HandlerDescriptorInterface
#50998
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
base: 7.4
Are you sure you want to change the base?
Conversation
The `HandlerDescriptor` class is final and therefore cannot be extended. To make this a bit more flexible we introduce the `HandlerDescriptorInterface` that is used everywhere. It also introduces a `.messenger.handler_descriptor_class` parameter that's used in the MessengerPass. With this parameter it's possible to use a custom implementation of the `HandlersLocator`. This is an alternative approach to symfony#50980.
Before I fix the failing tests, I'd like to know if this would be considered for merge or not. |
@OskarStark what do you think about this? |
We've removed this kind of parameter from our codebase and I don't think we want to start this again. A big issue with that class parameter is that it only works if the custom class uses the exact same constructor signature as the default implementation.
You could also just replace or decorate the service. |
Ahh, didn't think of decorating! Will update the PR to remove the parameter. |
@derrabus But how to decorate something like this: symfony/src/Symfony/Component/Messenger/DependencyInjection/MessengerPass.php Lines 166 to 169 in bb7a7dd
The only way I know, is to walk through the container definitions and find anything that starts with |
@nicolas-grekas What do you think of this? |
friendly ping @derrabus |
The
HandlerDescriptor
class is final and therefore cannot be extended. To make this a bit more flexible we introduce theHandlerDescriptorInterface
that is used everywhere.It also introduces a
.messenger.handler_descriptor_class
parameter that's used in the MessengerPass. With this parameter it's possible to use a custom implementation of theHandlersLocator
.This is an alternative approach to #50980. That PR also describes reasonings for this.