/** * 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); }
/** * 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); }