Handle queueable service events.

@param ServiceEvent $event

@return boolean
771521
public function handleServiceEvent($event)
    {
        Log::debug('Service event handled: ' . $event->name);

        if ($script = $this->getEventScript($event->name)) {
            Log::debug('Service event script found: ' . $event->name);
            $data = $event->makeData();

            if (null !== $result = $this->handleEventScript($script, $data)) {
                return $this->handleEventScriptResult($script, $result);
            }
        } elseif ($script = $this->getEventScript($event->name . '.queued')) {
            Log::debug('Queued service event script found: ' . $event->name);
            $result = $this->dispatchNow(new ServiceEventScriptJob($event->name . '.queued', $event, $script->config));
            Log::debug('Service event queued: ' . $event->name . PHP_EOL . $result);
        }

        return true;
    }
209013
public function handle(EventInterface $event)
    {

        try {
            // load the application server and the naming directory instance
            /** @var \AppserverIo\Psr\ApplicationServer\ApplicationServerInterface $applicationServer */
            $applicationServer = $this->getApplicationServer();
            /** @var \AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory */
            $namingDirectory = $applicationServer->getNamingDirectory();

            // load the configuration filename
            $configurationFilename = $applicationServer->getConfigurationFilename();

            // write a log message that the event has been invoked
            $applicationServer->getSystemLogger()->info($event->getName());

            // load the setup mode from the naming directory
            $setupMode = $namingDirectory->search('php:env/args/s');
            $currentUser = $namingDirectory->search('php:env/currentUser');

            // load the service instance and switch to the new setup mode
            /** @var \AppserverIo\Appserver\Core\Api\ContainerService $service */
            $service = $applicationServer->newService('AppserverIo\Appserver\Core\Api\ContainerService');
            $service->switchSetupMode($setupMode, $configurationFilename, $currentUser);

        } catch (NamingException $ne) {
            $applicationServer->getSystemLogger()->error('Please specify a setup mode, e. g. \'./server.php -s prod\'');
        } catch (\Exception $e) {
            $applicationServer->getSystemLogger()->error($e->__toString());
        }
    }
1292842
public function handleEventScriptEvent($event)
    {
        \Cache::forget(Cache::EVENT_SCRIPT_CACHE_PREFIX . $event->script->name);

        return true;
    }
1314241
public function handleEvent(Event $event, UserNotificationEventHandler $service)
    {
        // If our event is the wrong type, just do a null/void return
        if (!$event instanceof DeactivateUser) {
            return;
        }

        $entity = $event->getUserEntity();

        if ($entity) {
            $service->deactivated($event);
        }
    }
455796
protected function lazyLoad(string $eventType): void
    {
        if (isset($this->serviceIds[$eventType])) {
            foreach ($this->serviceIds[$eventType] as $args) {
                list($serviceId, $method, $priority) = $args;
                $service = $this->container->get($serviceId);
                $key = sprintf('%s.%s', $serviceId, $method);
                if (!isset($this->services[$eventType][$key])) {
                    $this->addHandler($eventType, [$service, $method], $priority);
                } elseif ($service !== $this->services[$eventType][$key]) {
                    parent::removeHandler($eventType, [$this->services[$eventType][$key], $method]);
                    $this->addHandler($eventType, [$service, $method], $priority);
                }
                $this->services[$eventType][$key] = $service;
            }
        }
    }
313821
public function handleBofhCommand(Event $event, Queue $queue)
    {
        $this->getLogger()->info('[BOFH] received a new command');

        $this->fetchExcuse($event, $queue);
    }
574131
public function handleEvent(ActionEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $environment = $event->getEnvironment();
        if (!$environment->getDataDefinition()->getBasicDefinition()->isCreatable()) {
            return;
        }

        if ('copy' !== $event->getAction()->getName()) {
            return;
        }

        if (true !== ($response = $this->checkPermission($environment))) {
            $event->setResponse($response);
            $event->stopPropagation();

            return;
        }

        if (false !== ($response = $this->process($environment))) {
            $event->setResponse($response);
        }
    }
1151118
private function invokeEvent($event)
    {
        if (array_key_exists($event->type, $this->_eventListeners)) {
            $listeners = $this->_eventListeners [$event->type];
        } else {
            return;
        }
        foreach ($listeners as $listener) {
            sd_call_user_func($listener, $event);
        }
    }
929197
public static function checkRequiredActions(Event $event = null)
    {
        /** @var RequiredActionService $service */
        $service = ServiceManager::getServiceManager()->get(self::CONFIG_ID);
        $action = $service->getActionToBePerformed([], $event);
        if ($action !== null) {
            $action->execute([], $event);
        }
    }
564525
protected function handle(Event $event): void
    {
        $method = 'apply'.ClassName::short($event);

        if (!method_exists($this, $method)) {
            return;
        }

        $this->$method($event);
    }
322763
public function publish(Event $event)
    {
        $massage = $this->serializer->serialize($event);
        $this->client->publish($this->queue_name, $massage);

        return true;
    }
839730
public function logServiceLocatorGet(ServiceManagerEvent $event)
    {
        return $this->registerServiceCall(
            $event->getServiceLocator(),
            $event->getInstance(),
            $event->getCanonicalName(),
            $event->getRequestedName(),
            'get',
            $event->getTrace()
        );
    }
895301
public function handleEvent(ActionEvent $event)
    {
        if (!$this->scopeDeterminator->currentScopeIsBackend()) {
            return;
        }

        $environment = $event->getEnvironment();
        $basic       = $environment->getDataDefinition()->getBasicDefinition();
        $action      = $event->getAction();

        if (null !== $event->getResponse()
            || ('showAll' !== $action->getName())
            || !$this->wantToHandle($basic->getMode(), $action)
        ) {
            return;
        }

        if (false !== ($response = $this->process($action, $environment))) {
            $event->setResponse($response);
        }
    }
1248274
protected function broadcastEvent($event)
    {
        $connection = ($event instanceof ShouldBroadcastNowInterface) ? 'sync' : null;

        $queue = method_exists($event, 'onQueue') ? $event->onQueue() : null;

        $this->resolveQueue()->connection($connection)->pushOn($queue, 'Nova\Broadcasting\BroadcastEvent', array(
            'event' => serialize(clone $event),
        ));
    }
1235168
public function handleCommandHelp(Event $event, Queue $queue)
    {

        $params = $event->getCustomParams();
        $provider = $this->getProvider(
            ($event->getCustomCommand() === "help") ? $params[0] : $event->getCustomCommand()
        );

        if ($provider) {
            $this->sendIrcResponse($event, $queue, $provider->getHelpLines());
        }
    }
836516
@MainThread
    private void handleEventPost(Event event) {
        Utils.log(event.getKey(), "Handling posted event");

        int sizeBefore = executionQueue.size();

        scheduleStatusUpdates(event, EventStatus.STARTED);
        scheduleSubscribersInvocation(event);

        if (((EventBase) event).handlersCount == 0) {
            Utils.log(event.getKey(), "No subscribers found");
            // Removing all scheduled STARTED status callbacks
            while (executionQueue.size() > sizeBefore) {
                executionQueue.removeLast();
            }
        } else {
            activeEvents.add(event);
            executeTasks(false);
        }
    }
983396
def fire_service_event(self, event):
        
        # Get the service properties
        properties = event.get_service_reference().get_properties()
        svc_specs = properties[OBJECTCLASS]
        previous = None
        endmatch_event = None
        svc_modified = event.get_kind() == ServiceEvent.MODIFIED

        if svc_modified:
            # Modified service event : prepare the end match event
            previous = event.get_previous_properties()
            endmatch_event = ServiceEvent(
                ServiceEvent.MODIFIED_ENDMATCH,
                event.get_service_reference(),
                previous,
            )

        with self.__svc_lock:
            # Get the listeners for this specification
            listeners = set()
            for spec in svc_specs:
                try:
                    listeners.update(self.__svc_listeners[spec])
                except KeyError:
                    pass

            # Add those which listen to any specification
            try:
                listeners.update(self.__svc_listeners[None])
            except KeyError:
                pass

        # Filter listeners with EventListenerHooks
        listeners = self._filter_with_hooks(event, listeners)

        # Get the listeners for this specification
        for data in listeners:
            # Default event to send : the one we received
            sent_event = event

            # Test if the service properties matches the filter
            ldap_filter = data.ldap_filter
            if ldap_filter is not None and not ldap_filter.matches(properties):
                # Event doesn't match listener filter...
                if (
                    svc_modified
                    and previous is not None
                    and ldap_filter.matches(previous)
                ):
                    # ... but previous properties did match
                    sent_event = endmatch_event
                else:
                    # Didn't match before either, ignore it
                    continue

            # Call'em
            try:
                data.listener.service_changed(sent_event)
            except:
                self._logger.exception("Error calling a service listener")