We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
<?php require 'vendor/autoload.php'; $eventBus = new \Prooph\ServiceBus\EventBus(); $router = new \Prooph\ServiceBus\Plugin\Router\EventRouter(); $router ->route(\Acme\SomethingHappended::class) ->to(\Acme\SomethingHappendedHandler2::class) ->andTo(function (\Acme\SomethingHappended $event) { echo $event->messageName() . ' called, too'; }); $router->attachToMessageBus($eventBus); $container = new class implements \Psr\Container\ContainerInterface { public function get($id) { switch ($id) { case \Acme\SomethingHappendedHandler2::class: return new \Acme\SomethingHappendedHandler2(); break; } } public function has($id) { return true; } }; $onEventHandlerStrategy = new \Prooph\ServiceBus\Plugin\InvokeStrategy\OnEventStrategy(); $onEventHandlerStrategy->attachToMessageBus($eventBus); $serviceLocatorPlugin = new \Prooph\ServiceBus\Plugin\ServiceLocatorPlugin($container); $serviceLocatorPlugin->attachToMessageBus($eventBus); $eventBus->dispatch(new \Acme\SomethingHappended(['1' => '2']));
output:
array(1) { [1]=> string(1) "2" } PHP Fatal error: Uncaught Error: Call to undefined method Closure::onEvent() in /home/sasa/code/service-bus-demo/vendor/prooph/service-bus/src/Plugin/InvokeStrategy/OnEventStrategy.php:35
Second problem: This strategy has to be attached with higher priority.
The text was updated successfully, but these errors were encountered:
fix OnEventStrategy
a5b7464
resolves #169
fix bugs in event bus
22e2d2b
prolic
Successfully merging a pull request may close this issue.
output:
Second problem: This strategy has to be attached with higher priority.
The text was updated successfully, but these errors were encountered: