Example #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $service = $input->getArgument('service');
     $parameters = $input->getArgument('parameters');
     $fetch = $input->getOption('fetch');
     $wait = !$input->getOption('no-wait');
     if (!$fetch && !$service) {
         $output->writeln('<error>The "service" argument is required when the --fetch option is not given.</error>');
         return 1;
     }
     $client = new \AlphaRPC\Client\Client();
     $client->addManager($this->diContainer->getParameter('client_handler'));
     if (!$input->getOption('fetch')) {
         $request = $client->startRequest($service, $parameters);
     } else {
         $request = new Request($service, $parameters);
         $request->setRequestId($input->getOption('fetch'));
     }
     echo $client->fetchResponse($request, $wait);
 }
Example #2
0
 /**
  * Returns a manager for the Request.
  *
  * It prefers the manager that is already set, but if it is
  * not, then it adds a random manager from the manager list.
  *
  * @param Request $request
  *
  * @return string
  */
 private function getManagerForRequest(Request $request)
 {
     if (!$request->getManager()) {
         $request->setManager($this->managerList->get());
     }
     return $request->getManager();
 }