-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
Description
Symfony version(s) affected: ^4.2
Description
Currently, MessengerPass
will compile the handler's definition that has class
option. This option is needed to guess the handler's method
and handles
options.
If we use parent
without class
, then we get exception fromMessengerPass
.
Proposition
If Definition
implements ChildDefinition
then we should get information from parent
class.
Example
For global_bus
will initialize correctly.
For command_bus
will throw exception:
Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\RuntimeException: Invalid service "command_bus": class "" does not exist. in /app/vendor/symfony/messenger/DependencyInjection/MessengerPass.php:85
services.yaml
Symfony\Component\Messenger\MessageBus:
abstract: true
public: true
class: Symfony\Component\Messenger\MessageBus
arguments:
- [] # Filled by MessengerPass
global_bus:
parent: Symfony\Component\Messenger\MessageBus
tags:
- { name: 'messenger.bus' }
# Due to MessengerPass, service marked as handler can't be abstract
command_bus:
parent: Symfony\Component\Messenger\MessageBus
tags:
- { name: 'messenger.bus'}
- { name: 'messenger.message_handler', handles: 'Infrastructure\Command\Command', method: 'dispatch', bus: 'global_bus'}