@see Router::forEvent
@see GearmanClient::doBackground

@param Event $event

@throws \Exception
12042
protected function doSendEvent(Event $event): void
    {
        if (!$this->shouldUseGearman()) {
            $this->locator->getEventBus()->receiveEvent($event);
            return;
        }

        $envelope = new TransportEnvelope($event, 'php');
        $channel = $this->router->forEvent($event);

        try {
            $client = $this->getClient();
            @$client->doBackground($channel, $envelope->toString(), (string)$event->get('event_id'));
            $this->validateReturnCode($client, $channel);
        } catch (\GearmanException $ge) {
            if (isset(self::$reconnectCodes[$ge->getCode()])) {
                $this->destroyClient();
                $this->locator->getEventBus()->receiveEvent($event);
                return;
            }

            throw $ge;
        } catch (\Throwable $e) {
            throw $e;
        }
    }
815308
public function jobException(Event $event)
    {
        $data = $event->data();
        $this->logger()->alert(sprintf('Exception: "%s"', $data['exception']->getMessage()));
    }
229710
protected function runSingleServerEvent($event)
    {
        if ($this->schedule->serverShouldRun($event, $this->startedAt)) {
            $this->runEvent($event);
        } else {
            $this->line('<info>Skipping command (has already run on another server):</info> '.$event->getSummaryForDisplay());
        }
    }
750795
private function captureStepEvent(Event $event)
    {
        if ($event instanceof AfterStepTested) {
            $this->afterStepTestedEvents[$event->getStep()->getLine()] = $event;
        }
        if ($event instanceof AfterStepSetup) {
            $this->afterStepSetupEvents[$event->getStep()->getLine()] = $event;
        }
    }
826734
public function runEvent($event)
    {
        $this->line('<info>Running scheduled command:</info> '.$event->getSummaryForDisplay());
        $event->run($this->laravel);
        $this->eventsRan = true;
    }
615636
public function onRequestError(Event $event)
	{
		$e = $this->factory->fromResponse($event['request'], $event['response']);
		$event->stopPropagation();
		throw $e;
	}
21371
public function on($event, $callback)
        {
            if (!is_callable($callback)) {
                throw new Exception('Socketio::on() type callback must be callable.');
            }

            if (!isset($this->callbacks[$event])) {
                $this->callbacks[$event] = array();
            }

            // @TODO Handle case where callback is a string
            if (in_array($callback, $this->callbacks[$event])) {
                $this->stdout('debug', 'Skip existing callback');
                return;
            }

            $this->callbacks[$event][] = $callback;
        }
964306
public function onDispatchDirect(Event $event)
    {
        $object = $event->getParam('object');
        $method = $event->getParam('rpc')->getMethod();

        // Check ACL
        if ($object instanceof \JaztecAcl\Direct\AuthorizedDirectObject) {
            if (!$object->checkAcl($method)) {
                $event->stopPropagation(true);

                return $object->notAllowed();
            }
        }
    }
1164318
final public function dispatch(Event $event): void
    {
        if (!$event instanceof ReceivedEvent && $this->discriminator->shouldEnqueue($event)) {
            $this->queue->send($event);
        }

        if ($event instanceof ReceivedEvent) {
            $event = $event->getOriginalEvent();
        }

        $this->wrappedEventBus->dispatch($event);
    }
698904
final protected function apply(DomainEvent $event) : void
    {
        $this->handleEventInAggregate($event);
        parent::raise($event);
    }
31907
public function handle($event)
    {
        if ($event instanceof RouteMatched) {
            $this->handleLaravelRoute($event);
        }

        if ($event instanceof GzeroRouteMatched) {
            $this->handleRoute($event);
        }
    }
1243502
protected function fireConnectionEvent( $event )
	{
		if( isset( $this->events ) )
		{
			switch( $event ) {
				case 'beganTransaction': $this->events->dispatch( new Events\TransactionBeginningEvent( $this ) ); break;
				case 'committed': $this->events->dispatch( new Events\TransactionCommittedEvent( $this ) ); break;
				case 'rollingBack': $this->events->dispatch( new Events\TransactionRolledBackEvent( $this ) ); break;
			}
		}
	}
113800
public function add_event_listener(string $event)
    {
        // Automatically instantiate this class
        if ( class_exists("\App\Boot") ) {
            // Excute a boot instance
            $boot = new \App\Boot();

            if ( method_exists($boot, $event) ) {
                call_user_func([$boot, $event], $this->server);
            }

            // Listen Background task listener
            if ($event == 'onBoot') {
                $this->server->on('task', [$boot, 'onTask']);
                $this->server->on('finish', [$boot, 'onFinish']);
            }
        }
    }
785891
public function onRequestBeforeSend(Event $event)
    {
        $request = $event['request'];

        $request->setHeader('Accept',(string) $this->config['accept-header']);

        return $this->config['accept-header'];
    }
1179673
public function onBackupFinished(BackupEvent $event)
    {
        if ($event->getStatus() === BackupStatus::STATE_FAILED
            && !$this->environment->continueFailedBackup($event->getException())
        ) {
            $event->cancel();
        }
    }
44692
public function beforeApiRequestSend($event)
    {
        $accessToken = $this->getAccessToken();
        if (!is_object($accessToken) || !$accessToken->getIsValid()) {
            throw new Exception('Invalid access token.');
        }

        $this->applyAccessTokenToRequest($event->request, $accessToken);
    }
668155
private function isEventDelayedUntilFirstBackgroundPrinted(Event $event)
    {
        if (!$event instanceof ScenarioTested && !$event instanceof OutlineTested && !$event instanceof ExampleTested) {
            return false;
        }

        return !$this->firstBackgroundEnded && $event->getFeature()->hasBackground();
    }