public function start()
    {
        $this->eventEmitter->emit(new DaemonStarted());

        $this->logger->info('Starting daemon...');

        $options = $this->handler->options(new ConsumeOptions());

        $this->driver->consume(
            $this->queueName,
            function (Message $message) {
                $this->eventEmitter->emit(new MessageReceived());
                $this->monitor->monitor($this, $message);

                $result = $this->handler->handle($message);

                $this->eventEmitter->emit(new MessageConsumed());
                pcntl_signal_dispatch();

                return $result;
            },
            $options->getTimeout(),
            $options->isAutoAck()
        );

        $this->stop();
    }
public function start()
    {
        $this->eventEmitter->emit(new DaemonStarted());

        $this->logger->info('Starting daemon...');

        $options = $this->handler->options(new ConsumeOptions());

        $this->driver->consume(
            $this->queueName,
            function (Message $message) {
                $this->eventEmitter->emit(new MessageReceived());
                $this->monitor->monitor($this, $message);

                $result = $this->handler->handle($message);

                $this->eventEmitter->emit(new MessageConsumed());
                pcntl_signal_dispatch();

                return $result;
            },
            $options->getTimeout(),
            $options->isAutoAck()
        );

        $this->stop();
    }
public function start ( ) { $ this -> eventEmitter -> emit ( new DaemonStarted ( ) ) ; $ this -> logger -> info ( 'Starting daemon...' ) ; $ options = $ this -> handler -> options ( new ConsumeOptions ( ) ) ; $ this -> driver -> consume ( $ this -> queueName , function ( Message $ message ) { $ this -> eventEmitter -> emit ( new MessageReceived ( ) ) ; $ this -> monitor -> monitor ( $ this , $ message ) ; $ result = $ this -> handler -> handle ( $ message ) ; $ this -> eventEmitter -> emit ( new MessageConsumed ( ) ) ; pcntl_signal_dispatch ( ) ; return $ result ; } , $ options -> getTimeout ( ) , $ options -> isAutoAck ( ) ) ; $ this -> stop ( ) ; }
Run the daemon

@return void
Run the daemon