Prooph\ServiceBus\Plugin\Router\RegexRouter::onRoute PHP Метод

onRoute() публичный Метод

Устаревший: Will be removed with v6.0, use method onRouteMessage instead
public onRoute ( Prooph\Common\Event\ActionEvent $actionEvent )
$actionEvent Prooph\Common\Event\ActionEvent
    public function onRoute(ActionEvent $actionEvent)
    {
        $this->onRouteMessage($actionEvent);
    }

Usage Example

Пример #1
0
 /**
  * @test
  */
 public function it_still_works_if_deprecated_method_on_route_is_used()
 {
     $router = new RegexRouter(['/^' . preg_quote('ProophTest\\ServiceBus\\Mock\\Do') . '.*/' => 'DoSomethingHandler', '/^' . preg_quote('ProophTest\\ServiceBus\\Mock\\') . '.*Done$/' => ["SomethingDoneListener1", "SomethingDoneListener2"]]);
     $actionEvent = new DefaultActionEvent(MessageBus::EVENT_ROUTE, new CommandBus(), [MessageBus::EVENT_PARAM_MESSAGE_NAME => 'ProophTest\\ServiceBus\\Mock\\DoSomething']);
     $router->onRoute($actionEvent);
     $this->assertEquals("DoSomethingHandler", $actionEvent->getParam(MessageBus::EVENT_PARAM_MESSAGE_HANDLER));
     $actionEvent = new DefaultActionEvent(MessageBus::EVENT_ROUTE, new EventBus(), [MessageBus::EVENT_PARAM_MESSAGE_NAME => 'ProophTest\\ServiceBus\\Mock\\SomethingDone']);
     $router->onRoute($actionEvent);
     $this->assertEquals(["SomethingDoneListener1", "SomethingDoneListener2"], $actionEvent->getParam(EventBus::EVENT_PARAM_EVENT_LISTENERS));
 }