public function dispatch() {
		while (true) {
			if ($this->_break) {
				break;
			}
			if ($this->_paused) {
				$this->_title('Paused, waiting');
				$this->_log->debug('Paused, waiting.');
			}
			while ($this->_paused) {
				pcntl_signal_dispatch();
				sleep($this->_interval);
			}

			$this->_title('Waiting for job');
			$this->_log->debug('Waiting for job.');

			while (!$this->_job) {
				// FIXME Catch exception. but only handler exceptions.
				$this->_job = $this->_connection->reserve($this->_queues, 5);
				pcntl_signal_dispatch();
			}
			$this->_title("Performing job {$this->_job}");
			$this->_log->debug("Performing job {$this->_job}.");

			try {
				if ($this->_job->perform()) {
					$this->_job->succeed();
				} else {
					$this->_job->fail();
				}
			} catch (Exception $e) {
				$this->_log->notice(get_class($e) . ' while performing job: ' . $e->getMessage());
				$this->_job->fail();
			}
			$this->_job = null;
		}
	}
public function dispatch() {
		while (true) {
			if ($this->_break) {
				break;
			}
			if ($this->_paused) {
				$this->_title('Paused, waiting');
				$this->_log->debug('Paused, waiting.');
			}
			while ($this->_paused) {
				pcntl_signal_dispatch();
				sleep($this->_interval);
			}

			$this->_title('Waiting for job');
			$this->_log->debug('Waiting for job.');

			while (!$this->_job) {
				// FIXME Catch exception. but only handler exceptions.
				$this->_job = $this->_connection->reserve($this->_queues, 5);
				pcntl_signal_dispatch();
			}
			$this->_title("Performing job {$this->_job}");
			$this->_log->debug("Performing job {$this->_job}.");

			try {
				if ($this->_job->perform()) {
					$this->_job->succeed();
				} else {
					$this->_job->fail();
				}
			} catch (Exception $e) {
				$this->_log->notice(get_class($e) . ' while performing job: ' . $e->getMessage());
				$this->_job->fail();
			}
			$this->_job = null;
		}
	}
public function dispatch ( ) { while ( true ) { if ( $ this -> _break ) { break ; } if ( $ this -> _paused ) { $ this -> _title ( 'Paused, waiting' ) ; $ this -> _log -> debug ( 'Paused, waiting.' ) ; } while ( $ this -> _paused ) { pcntl_signal_dispatch ( ) ; sleep ( $ this -> _interval ) ; } $ this -> _title ( 'Waiting for job' ) ; $ this -> _log -> debug ( 'Waiting for job.' ) ; while ( ! $ this -> _job ) { // FIXME Catch exception. but only handler exceptions. $ this -> _job = $ this -> _connection -> reserve ( $ this -> _queues , 5 ) ; pcntl_signal_dispatch ( ) ; } $ this -> _title ( "Performing job {$this->_job}" ) ; $ this -> _log -> debug ( "Performing job {$this->_job}." ) ; try { if ( $ this -> _job -> perform ( ) ) { $ this -> _job -> succeed ( ) ; } else { $ this -> _job -> fail ( ) ; } } catch ( Exception $ e ) { $ this -> _log -> notice ( get_class ( $ e ) . ' while performing job: ' . $ e -> getMessage ( ) ) ; $ this -> _job -> fail ( ) ; } $ this -> _job = null ; } }
Main method to start processing loop and dispatch jobs.

@return boolean
Main method to start processing loop and dispatch jobs .