public function addJob(string $class, $data, array $options = []): Process
    {
        $document = $this->prepareInsert($class, $data, $options);

        $result = $this->db->{$this->job_queue}->insertOne($document);
        $this->logger->debug('queue job ['.$result->getInsertedId().'] added to ['.$class.']', [
            'category' => get_class($this),
            'params' => $options,
            'data' => $data,
        ]);

        $this->db->{$this->event_queue}->insertOne([
            'job' => $result->getInsertedId(),
            'status' => JobInterface::STATUS_WAITING,
            'timestamp' => new UTCDateTime(),
        ]);

        $document = $this->db->{$this->job_queue}->findOne(['_id' => $result->getInsertedId()], [
            'typeMap' => self::TYPE_MAP,
        ]);

        $process = new Process($document, $this, $this->events);

        return $process;
    }
public function addJob(string $class, $data, array $options = []): Process
    {
        $document = $this->prepareInsert($class, $data, $options);

        $result = $this->db->{$this->job_queue}->insertOne($document);
        $this->logger->debug('queue job ['.$result->getInsertedId().'] added to ['.$class.']', [
            'category' => get_class($this),
            'params' => $options,
            'data' => $data,
        ]);

        $this->db->{$this->event_queue}->insertOne([
            'job' => $result->getInsertedId(),
            'status' => JobInterface::STATUS_WAITING,
            'timestamp' => new UTCDateTime(),
        ]);

        $document = $this->db->{$this->job_queue}->findOne(['_id' => $result->getInsertedId()], [
            'typeMap' => self::TYPE_MAP,
        ]);

        $process = new Process($document, $this, $this->events);

        return $process;
    }
public function addJob ( string $ class , $ data , array $ options = [ ] ) : Process { $ document = $ this -> prepareInsert ( $ class , $ data , $ options ) ; $ result = $ this -> db -> { $ this -> job_queue } -> insertOne ( $ document ) ; $ this -> logger -> debug ( 'queue job [' . $ result -> getInsertedId ( ) . '] added to [' . $ class . ']' , [ 'category' => get_class ( $ this ) , 'params' => $ options , 'data' => $ data , ] ) ; $ this -> db -> { $ this -> event_queue } -> insertOne ( [ 'job' => $ result -> getInsertedId ( ) , 'status' => JobInterface :: STATUS_WAITING , 'timestamp' => new UTCDateTime ( ) , ] ) ; $ document = $ this -> db -> { $ this -> job_queue } -> findOne ( [ '_id' => $ result -> getInsertedId ( ) ] , [ 'typeMap' => self :: TYPE_MAP , ] ) ; $ process = new Process ( $ document , $ this , $ this -> events ) ; return $ process ; }
Add job to queue.
Add job to queue .