public function runTasks()
    {
        $gearmanClient = $this->getNativeClient();
        $this->assignServers($gearmanClient);

        if ($this->settings['callbacks']) {

            $this->gearmanCallbacksDispatcher->assignTaskCallbacks($gearmanClient);
        }

        foreach ($this->taskStructure as $task) {

            $type = $task['method'];
            $jobName = $task['name'];
            $worker = $this->getJob($jobName);

            if (false !== $worker) {

                $gearmanClient->$type(
                    $worker['job']['realCallableName'],
                    $task['params'],
                    $task['context'],
                    $task['unique']
                );
            }
        }

        $this->initTaskStructure();

        $this->gearmanClient = null;

        return $gearmanClient->runTasks();
    }