/** * {@inheritdoc} */ public function dispatch(RequestInterface $request, ResponseInterface $response = null) { parent::dispatch($request, $response); /* @var $request \Zend\Console\Request */ /* @var $response \Zend\Console\Response */ if (!$request->getParam('without-signals') && !$request->getParam('w')) { $this->registerSignalHandler(); } $rpcServerName = $request->getParam('name'); if (!$this->getRpcServerManager()->has($rpcServerName)) { $this->getConsole()->writeLine('ERROR: RPC-Server "' . $rpcServerName . '" not found', ColorInterface::RED); $response->setErrorLevel(1); return; } $amount = $request->getParam('amount', 0); if (!is_numeric($amount)) { $this->getConsole()->writeLine('Error: Expected integer for amount', ColorInterface::RED); $response->setErrorLevel(1); return; } else { $this->rpcServer = $this->getRpcServerManager()->get($rpcServerName); $this->rpcServer->consume($amount); } }