protected function connectHooks($taskId, $jobObject)
    {

        if ($jobObject instanceof Chatty) {
            $jobObject->onMessage(function ($message, $level=Chatty::INFO) use ($taskId) {
                $this->writeMessage($taskId, $message, $level);
            });
        }

        if ($jobObject instanceof PublishesProgress) {
            $jobObject->onProgressChanged(function (Progress $progress) use ($taskId) {
                $this->writeProgress($taskId, $progress);
            });
        }
    }