public function registerJob(string $jobName, callable $callback) : bool
    {
        $this->callbacks[$jobName] = $callback;
        $this->jobSocket->subscribe($jobName);

        // register job at server:
        $this->replySocket->send(json_encode([
            'request' => 'register_job',
            'worker_id' => $this->workerId,
            'job_name' => $jobName
        ]));
        $response = $this->replySocket->recv();
        return ($response === 'ok');
    }
public function registerJob(string $jobName, callable $callback) : bool
    {
        $this->callbacks[$jobName] = $callback;
        $this->jobSocket->subscribe($jobName);

        // register job at server:
        $this->replySocket->send(json_encode([
            'request' => 'register_job',
            'worker_id' => $this->workerId,
            'job_name' => $jobName
        ]));
        $response = $this->replySocket->recv();
        return ($response === 'ok');
    }
public function registerJob ( string $ jobName , callable $ callback ) : bool { $ this -> callbacks [ $ jobName ] = $ callback ; $ this -> jobSocket -> subscribe ( $ jobName ) ; // register job at server: $ this -> replySocket -> send ( json_encode ( [ 'request' => 'register_job' , 'worker_id' => $ this -> workerId , 'job_name' => $ jobName ] ) ) ; $ response = $ this -> replySocket -> recv ( ) ; return ( $ response === 'ok' ) ; }
Registers a type of job the worker is able to do.

@param string $jobName
@param callable $callback
@return bool
Registers a type of job the worker is able to do .