/** * Handles a Message from the Service Handler. * * @param MessageInterface $msg */ public function onServiceMessage(MessageInterface $msg) { $this->serviceStreamReady = true; $this->getLogger()->debug('Received Service Message of Type: ' . get_class($msg)); if ($msg instanceof ActionListResponse) { $actions = $msg->getActions(); $this->getLogger()->debug('The action list is: ' . implode(', ', $actions) . '.'); $this->worker->setActions($actions); $reply = new Register(); $reply->setActions($actions); $this->sendToWorkerHandler($reply); unset($reply); return; } if ($msg instanceof ExecuteJobResponse) { $requestId = $msg->getRequestId(); $result = $msg->getResult(); $this->getLogger()->debug('Result for: ' . $requestId . ': ' . $result); $this->worker->setResult($requestId, $result); return; } $this->getLogger()->error('Unknown service response: ' . get_class($msg) . '.'); }