public function process()
    {
        if ($this->worker->getState() == Worker::INVALID) {
            throw new \RuntimeException('Invalid state to process.');
        }

        $expiry = 5000 + $this->delay;
        if ($this->worker->isExpired($expiry)) {
            $this->getLogger()->debug('Worker is expired, no longer registered to workerhandler.');
            $this->worker->setState(Worker::INVALID);

            return;
        }

        try {
            $read = $write = array();
            $this->getPoller()->poll($read, $write, 100);
        } catch (\ZMQPollException $ex) {
            pcntl_signal_dispatch();

            return;
        }

        $this->workerHandlerStream->handle();
        $this->serviceStream->handle();
        $this->handleResult();
        $this->heartbeat();
        pcntl_signal_dispatch();
    }
public function process()
    {
        if ($this->worker->getState() == Worker::INVALID) {
            throw new \RuntimeException('Invalid state to process.');
        }

        $expiry = 5000 + $this->delay;
        if ($this->worker->isExpired($expiry)) {
            $this->getLogger()->debug('Worker is expired, no longer registered to workerhandler.');
            $this->worker->setState(Worker::INVALID);

            return;
        }

        try {
            $read = $write = array();
            $this->getPoller()->poll($read, $write, 100);
        } catch (\ZMQPollException $ex) {
            pcntl_signal_dispatch();

            return;
        }

        $this->workerHandlerStream->handle();
        $this->serviceStream->handle();
        $this->handleResult();
        $this->heartbeat();
        pcntl_signal_dispatch();
    }
public function process ( ) { if ( $ this -> worker -> getState ( ) == Worker :: INVALID ) { throw new \ RuntimeException ( 'Invalid state to process.' ) ; } $ expiry = 5000 + $ this -> delay ; if ( $ this -> worker -> isExpired ( $ expiry ) ) { $ this -> getLogger ( ) -> debug ( 'Worker is expired, no longer registered to workerhandler.' ) ; $ this -> worker -> setState ( Worker :: INVALID ) ; return ; } try { $ read = $ write = array ( ) ; $ this -> getPoller ( ) -> poll ( $ read , $ write , 100 ) ; } catch ( \ ZMQPollException $ ex ) { pcntl_signal_dispatch ( ) ; return ; } $ this -> workerHandlerStream -> handle ( ) ; $ this -> serviceStream -> handle ( ) ; $ this -> handleResult ( ) ; $ this -> heartbeat ( ) ; pcntl_signal_dispatch ( ) ; }
Perform one service cycle.
This method checks whether there are any new requests to be handled,
either from the Worker Handler or from the Service.
Perform one service cycle . This method checks whether there are any new requests to be handled either from the Worker Handler or from the Service .