Handle the result of a Job that a WorkerHandler processed.

@param ClientHandlerJobResponse $msg
774142
public function onWorkerHandlerMessage(ClientHandlerJobResponse $msg)
    {
        $this->workerHandlerReady = true;

        $requestId = $msg->getRequestId();
        if (isset($this->workerHandlerQueue[$requestId])) {
            unset($this->workerHandlerQueue[$requestId]);
        }

        $workerHandler = $msg->getWorkerHandlerId();
        $request       = $this->getRequest($requestId);

        if ($request === null) {
            $this->getLogger()->info(
                sprintf(
                    'WorkerHandler %s accepted request %s, but request is unknown.',
                    $workerHandler,
                    $requestId
                )
            );

            return;
        }

        $this->getLogger()->debug(
            sprintf(
                'Worker-handler %s accepted request: %s.',
                $workerHandler,
                $requestId
            )
        );

        $request->setWorkerHandlerId($workerHandler);
    }
1207257
private function toUserOutput(string $msg) {
    $renderer = new \Nuki\Handlers\Http\Output\Renderers\RawRenderer();
    $response = new \Nuki\Handlers\Http\Output\Response($renderer);

    $renderer->setContent(new \Nuki\Models\IO\Output\Content($msg));

    $response->httpStatusCode(\Nuki\Models\IO\Output\Http::HTTP_EXPECTATION_FAILED);

    $response->send();

    return;
  }
124628
private function log($msg)
    {
        $logger = $this->getConfig('logger');
        if (!$logger) return false;
        return call_user_func_array($logger, array($msg));
    }
757613
@Override
    public void handle(Message<Void> msg) {
        msg.reply(dependency.getClass().getName());
    }
1318925
public function job_complete($handle, $job, $result) {

        $this->log("($handle) Completed Job: $job", GearmanManager::LOG_LEVEL_WORKER_INFO);

        $this->log_result($handle, $result);
    }
967449
def msg_handle(msg, err)

      fexp = Ruote::Exp::FlowExpression.fetch(
        @context, msg['fei'] || msg['workitem']['fei']
      ) rescue nil

      handle(msg, fexp, err)
    end
241265
public final void update( final long newworked, final String msg) {
    if( newworked > 0 || (msg != null && !msg.equals(_msg)) ) {
      new JAtomic() {
        @Override boolean abort(Job job) { return newworked==0 && ((msg==null && _msg==null) || (msg != null && msg.equals(job._msg))); }
        @Override void update(Job old) { old._worked += newworked; old._msg = msg; }
      }.apply(this);
    }
  }
930675
public function handle(EventMessage $event)
    {
        if ($event instanceof \PAMI\Message\Event\AsyncAGIEvent) {
            if ($event->getCommandId() == $this->lastCommandId) {
                $this->lastAgiResult = trim($event->getResult());
            }
        }
    }
918942
protected static function output_msg($msg) {
        global $CFG, $PAGE;

        // If we are using the web interface we want pretty messages.
        if (!CLI_SCRIPT) {

            $renderer = $PAGE->get_renderer('tool_behat');
            echo $renderer->render_error($msg);

            // Stopping execution.
            exit(1);

        } else {

            // We continue execution after this.
            $clibehaterrorstr = "Ensure you set \$CFG->behat_* vars in config.php " .
                "and you ran admin/tool/behat/cli/init.php.\n" .
                "More info in " . self::DOCS_URL;

            echo 'Error: ' . $msg . "\n\n" . $clibehaterrorstr;
        }
    }
1094530
public function log($msg)
    {
        $agi = $this->getAgi();
        $this->logger->debug($msg);
        $agi->consoleLog($msg);
    }
102548
protected function handleNICK($origin, $msg)
    {
        // :oldnick!ident@host NICK newnick
        return $this->connection->dispatch(
            $this->makeEvent('!Nick', $origin, $msg[0])
        );
    }
323562
public function executeMsg(JobMessage $msg, ExecutionContext $execution = null)
    {
        if (null === $execution) {
            $execution = $this->createJobExecutionFromMessage($msg);
        }

        return $msg->execute($execution, $this->msgFactory);
    }
1007087
public function reply(Worker $worker, MessageInterface $msg)
    {
        if (!$worker->isReady()) {
            $this->getLogger()->debug(
                'Worker '.$worker->getHexId().' is not ready to receive data.');

            return;
        }
        $worker->setReady(false);

        if (!$worker->isValid()) {
            $this->getLogger()->debug(
                'Worker '.$worker->getHexId().' is not valid, destroying.');
            $msg = new Destroy();
        }

        $this->getStream('worker')->send($msg, $worker->getId());
    }
92429
protected function handleError($code, $msg) {
    if (isset($this->options['error_handler'])) {
      $handler = $this->options['error_handler'];
      $handler($code, $msg);
    }

    if ($this->debug()) {
      error_log("[Analytics][" . $this->type . "] " . $msg);
    }
  }
356062
protected function handleJobException($job, QueueMessage $message, Structure $options, $e)
    {
        if (!$job instanceof JobInterface) {
            $job = new NullJob();
        }

        $this->logger->error(
            sprintf(
                'Job [%s] (%s) failed: %s - Class: %s',
                $job->getName(),
                $message->getId(),
                $e->getMessage(),
                get_class($job)
            )
        );

        if (method_exists($job, 'failed')) {
            $job->failed($e);
        }

        $maxTries = (int) $options->get('tries', 5);

        // Delete and log error if reach max attempts.
        if ($maxTries !== 0 && $maxTries <= $message->getAttempts()) {
            $this->manager->delete($message);
            $this->logger->error(
                sprintf(
                    'Max attempts exceeded. Job: %s (%s) - Class: %s',
                    $job->getName(),
                    $message->getId(),
                    get_class($job)
                )
            );
        }

        $this->dispatcher->triggerEvent(
            'onWorkerJobFailure',
            [
                'worker' => $this,
                'exception' => $e,
                'job' => $job,
                'message' => $message,
            ]
        );
    }
962023
public function handle(
        $msgType,
        \fpoirotte\Pssht\Wire\Decoder $decoder,
        \fpoirotte\Pssht\Transport $transport,
        array &$context
    ) {
        return true;
    }
964251
def handle(handler, msg, sender, &block)
      @session.validate! sender if handler.validate?

      next_state, reply = handler.handle msg, @state, @session, sender

      return if abort_state_change?(next_state, &block)
      @state = next_state

      return unless reply

      sender.reply reply + "\r"
      logger.debug reply
    rescue Session::InvalidSender => e
      sender.reply "?\r"
      logger.warn e.message
    end