create generic messenger handlers for query & command bus
use Streak\Application\Command;
use Streak\Application\CommandBus;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
/**
* Simple messenger adapter for Streak command bus.
*
* @author Alan Gabriel Bem <alan.bem@gmail.com>
*/
class CommandDispatchingHandler implements MessageHandlerInterface
{
private CommandBus $bus;
public function __construct(CommandBus $bus)
{
$this->bus = $bus;
}
public function __invoke(Command $command) : void
{
$this->bus->dispatch($command);
}
}
create generic messenger handlers for query & command bus