Make CommandBus use CommandResolverInterface

* Add CommandResolverInterface to resolve commands.
* Replace single CommandRegistry with CommandResolverInterface[]
  in CommandBus.
* Make CommandRegistry implement CommandResolverInterface.
This commit is contained in:
2024-12-15 13:24:57 +01:00
parent 585be681bd
commit 07f8ae467c
4 changed files with 95 additions and 9 deletions

View File

@ -38,8 +38,8 @@ class CommandBusClient implements CommandBusInterface
{
$this->commandRegistry = $commandRegistry;
if ($commandRegistry) {
$commandRegistry->on(CommandRegistry::EVENT_REGISTERED, $this->onCommandRegistered(...));
$commandRegistry->on(CommandRegistry::EVENT_UNREGISTERED, $this->onCommandUnregistered(...));
$this->commandRegistry->on(CommandRegistry::EVENT_REGISTERED, $this->onCommandRegistered(...));
$this->commandRegistry->on(CommandRegistry::EVENT_UNREGISTERED, $this->onCommandUnregistered(...));
}
$this->connector = $connector??new TcpConnector();
}