examples/resources/TaskFail.php
public function run(PayloadInterface $payload)
    {
        $this->runCounter++;

        if ($this->runCounter <= $this->failCount) {
            // 2 retries triggered by method
            $this->retry();
        }

        /** @var ArrayPayload $payload */
        $payload->setData(
            array_merge(
                $payload->getData(),
                array(
                    __CLASS__ => true
                )
            )
        );
    }
public function run(PayloadInterface $payload)
    {
        $this->runCounter++;

        if ($this->runCounter <= $this->failCount) {
            // 2 retries triggered by method
            $this->retry();
        }

        /** @var ArrayPayload $payload */
        $payload->setData(
            array_merge(
                $payload->getData(),
                array(
                    __CLASS__ => true
                )
            )
        );
    }
Executes the task.

@param PayloadInterface $payload

@return null