/**
  * Starts a Job.
  *
  * @param ExecuteJobRequest $request
  */
 public function startJob(ExecuteJobRequest $request)
 {
     $this->worker->setState(Worker::BUSY);
     $requestId = $request->getRequestId();
     $action = $request->getAction();
     if (!$this->worker->hasAction($action)) {
         $this->getLogger()->debug('Action ' . $action . ' not found.');
         $this->sendToWorkerHandler(new ActionNotFound($requestId, $action));
         return;
     }
     $this->getLogger()->debug('Sending new request (' . $requestId . ') to action ' . $action);
     $this->serviceStream->send($request);
 }
 public function testRoundtrip()
 {
     $pm = new ProtocolMessage('12345', 'service', array('hello world'));
     $pm2 = ProtocolMessage::fromMessage($pm->toMessage());
     $this->assertEquals($pm, $pm2);
 }