library/AbstractWorkerController.php
public function process(MessageInterface $message)
    {

        $event   = $this->getProcessEvent();
        $event->setWorker($this);
        $event->setMessage($message);

        $events  = $this->getEventManager();
        $results = $events->trigger(ProcessEvent::EVENT_PROCESSOR, $event, function ($result) {
            return ($result instanceof ProcessorInterface);
        });
        $processor = $results->last();
        if (!$processor instanceof ProcessorInterface) {
            throw new \RuntimeException(sprintf(
                '%s: no processor selected!',
                __METHOD__
            ));
        }

        $processor->setWorker($this);
        $event->setProcessor($processor);

        $result = $processor->process($message);
        $event->setResult($result);

        $events->trigger(ProcessEvent::EVENT_PROCESS_POST, $event);


        return $result;
    }
public function process(MessageInterface $message)
    {

        $event   = $this->getProcessEvent();
        $event->setWorker($this);
        $event->setMessage($message);

        $events  = $this->getEventManager();
        $results = $events->trigger(ProcessEvent::EVENT_PROCESSOR, $event, function ($result) {
            return ($result instanceof ProcessorInterface);
        });
        $processor = $results->last();
        if (!$processor instanceof ProcessorInterface) {
            throw new \RuntimeException(sprintf(
                '%s: no processor selected!',
                __METHOD__
            ));
        }

        $processor->setWorker($this);
        $event->setProcessor($processor);

        $result = $processor->process($message);
        $event->setResult($result);

        $events->trigger(ProcessEvent::EVENT_PROCESS_POST, $event);


        return $result;
    }
public function process ( MessageInterface $ message ) { $ event = $ this -> getProcessEvent ( ) ; $ event -> setWorker ( $ this ) ; $ event -> setMessage ( $ message ) ; $ events = $ this -> getEventManager ( ) ; $ results = $ events -> trigger ( ProcessEvent :: EVENT_PROCESSOR , $ event , function ( $ result ) { return ( $ result instanceof ProcessorInterface ) ; } ) ; $ processor = $ results -> last ( ) ; if ( ! $ processor instanceof ProcessorInterface ) { throw new \ RuntimeException ( sprintf ( '%s: no processor selected!' , __METHOD__ ) ) ; } $ processor -> setWorker ( $ this ) ; $ event -> setProcessor ( $ processor ) ; $ result = $ processor -> process ( $ message ) ; $ event -> setResult ( $ result ) ; $ events -> trigger ( ProcessEvent :: EVENT_PROCESS_POST , $ event ) ; return $ result ; }
Process a message

@param MessageInterface $message
@return mixed
@throws Exception\InvalidMessageException
Process a message