Ejemplo n.º 1
0
 /**
  * Exception handler
  *
  * @param Exception $e
  */
 public function exceptionHandler($e)
 {
     $response = new Response();
     $response->setException(get_class($e));
     $response->setExceptionMessage($e->getMessage());
     $response->setHasException(true);
     $this->transport->reply($response);
 }
Ejemplo n.º 2
0
 /**
  * Invoke service
  *
  * @param Invocation $invocation
  * @return mixed
  * @throws InitiallyRpcException
  */
 public function invoke(Invocation $invocation)
 {
     $request = new Request();
     $request->setInterface($this->interface);
     $request->setMethodName($invocation->getMethodName());
     $request->setArguments($invocation->getArguments());
     $transport = Transport::factory($this->config->getTransport());
     if (!$transport instanceof Transport) {
         throw new InitiallyRpcException("missing transport");
     }
     return $transport->send($request);
 }