public function push($job)
    {
        $event = new PushEvent([
            'job' => $job,
            'ttr' => $this->pushTtr ?: (
                $job instanceof RetryableJobInterface
                    ? $job->getTtr()
                    : $this->ttr
            ),
            'delay' => $this->pushDelay ?: 0,
            'priority' => $this->pushPriority,
        ]);
        $this->pushTtr = null;
        $this->pushDelay = null;
        $this->pushPriority = null;

        $this->trigger(self::EVENT_BEFORE_PUSH, $event);
        if ($event->handled) {
            return null;
        }

        if ($this->strictJobType && !($event->job instanceof JobInterface)) {
            throw new InvalidArgumentException('Job must be instance of JobInterface.');
        }

        if (!is_numeric($event->ttr)) {
            throw new InvalidArgumentException('Job TTR must be integer.');
        }
        $event->ttr = (int) $event->ttr;
        if ($event->ttr <= 0) {
            throw new InvalidArgumentException('Job TTR must be greater that zero.');
        }

        if (!is_numeric($event->delay)) {
            throw new InvalidArgumentException('Job delay must be integer.');
        }
        $event->delay = (int) $event->delay;
        if ($event->delay < 0) {
            throw new InvalidArgumentException('Job delay must be positive.');
        }

        $message = $this->serializer->serialize($event->job);
        $event->id = $this->pushMessage($message, $event->ttr, $event->delay, $event->priority);
        $this->trigger(self::EVENT_AFTER_PUSH, $event);

        return $event->id;
    }
public function push($job)
    {
        $event = new PushEvent([
            'job' => $job,
            'ttr' => $this->pushTtr ?: (
                $job instanceof RetryableJobInterface
                    ? $job->getTtr()
                    : $this->ttr
            ),
            'delay' => $this->pushDelay ?: 0,
            'priority' => $this->pushPriority,
        ]);
        $this->pushTtr = null;
        $this->pushDelay = null;
        $this->pushPriority = null;

        $this->trigger(self::EVENT_BEFORE_PUSH, $event);
        if ($event->handled) {
            return null;
        }

        if ($this->strictJobType && !($event->job instanceof JobInterface)) {
            throw new InvalidArgumentException('Job must be instance of JobInterface.');
        }

        if (!is_numeric($event->ttr)) {
            throw new InvalidArgumentException('Job TTR must be integer.');
        }
        $event->ttr = (int) $event->ttr;
        if ($event->ttr <= 0) {
            throw new InvalidArgumentException('Job TTR must be greater that zero.');
        }

        if (!is_numeric($event->delay)) {
            throw new InvalidArgumentException('Job delay must be integer.');
        }
        $event->delay = (int) $event->delay;
        if ($event->delay < 0) {
            throw new InvalidArgumentException('Job delay must be positive.');
        }

        $message = $this->serializer->serialize($event->job);
        $event->id = $this->pushMessage($message, $event->ttr, $event->delay, $event->priority);
        $this->trigger(self::EVENT_AFTER_PUSH, $event);

        return $event->id;
    }
public function push ( $ job ) { $ event = new PushEvent ( [ 'job' => $ job , 'ttr' => $ this -> pushTtr ? : ( $ job instanceof RetryableJobInterface ? $ job -> getTtr ( ) : $ this -> ttr ) , 'delay' => $ this -> pushDelay ? : 0 , 'priority' => $ this -> pushPriority , ] ) ; $ this -> pushTtr = null ; $ this -> pushDelay = null ; $ this -> pushPriority = null ; $ this -> trigger ( self :: EVENT_BEFORE_PUSH , $ event ) ; if ( $ event -> handled ) { return null ; } if ( $ this -> strictJobType && ! ( $ event -> job instanceof JobInterface ) ) { throw new InvalidArgumentException ( 'Job must be instance of JobInterface.' ) ; } if ( ! is_numeric ( $ event -> ttr ) ) { throw new InvalidArgumentException ( 'Job TTR must be integer.' ) ; } $ event -> ttr = ( int ) $ event -> ttr ; if ( $ event -> ttr <= 0 ) { throw new InvalidArgumentException ( 'Job TTR must be greater that zero.' ) ; } if ( ! is_numeric ( $ event -> delay ) ) { throw new InvalidArgumentException ( 'Job delay must be integer.' ) ; } $ event -> delay = ( int ) $ event -> delay ; if ( $ event -> delay < 0 ) { throw new InvalidArgumentException ( 'Job delay must be positive.' ) ; } $ message = $ this -> serializer -> serialize ( $ event -> job ) ; $ event -> id = $ this -> pushMessage ( $ message , $ event -> ttr , $ event -> delay , $ event -> priority ) ; $ this -> trigger ( self :: EVENT_AFTER_PUSH , $ event ) ; return $ event -> id ; }
Pushes job into queue.

@param JobInterface|mixed $job
@return string|null id of a job message
Pushes job into queue .