Skip to content
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

integrate with symfony messenger #56

Open
alanbem opened this issue Mar 31, 2021 · 0 comments
Open

integrate with symfony messenger #56

alanbem opened this issue Mar 31, 2021 · 0 comments

Comments

@alanbem
Copy link
Member

alanbem commented Mar 31, 2021

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);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant