public function resolve(CommunicatorServiceInterface $communicatorService)
    {
        foreach ($this->promises as $key => $promise) {
            /** @var AmqpMessage $result */
            try {
                $result = $promise->receive();

                $response = $communicatorService->request($this->services[$key])->getProducer()
                    ->getResponse()
                    ->hydrate($result->getBody());

                $this->queryResults[$this->services[$key]] = $response;
            } catch (TimeoutException $e) {
                $this->queryResults[$this->services[$key]] = new Response($e->getMessage(), 503);
            } catch (\Exception $e) {
                $this->queryResults[$this->services[$key]] = new Response($e->getMessage(), $e->getCode());
            }
        }

        return $this->queryResults;
    }
public function resolve(CommunicatorServiceInterface $communicatorService)
    {
        foreach ($this->promises as $key => $promise) {
            /** @var AmqpMessage $result */
            try {
                $result = $promise->receive();

                $response = $communicatorService->request($this->services[$key])->getProducer()
                    ->getResponse()
                    ->hydrate($result->getBody());

                $this->queryResults[$this->services[$key]] = $response;
            } catch (TimeoutException $e) {
                $this->queryResults[$this->services[$key]] = new Response($e->getMessage(), 503);
            } catch (\Exception $e) {
                $this->queryResults[$this->services[$key]] = new Response($e->getMessage(), $e->getCode());
            }
        }

        return $this->queryResults;
    }
public function resolve ( CommunicatorServiceInterface $ communicatorService ) { foreach ( $ this -> promises as $ key => $ promise ) { /** @var AmqpMessage $result */ try { $ result = $ promise -> receive ( ) ; $ response = $ communicatorService -> request ( $ this -> services [ $ key ] ) -> getProducer ( ) -> getResponse ( ) -> hydrate ( $ result -> getBody ( ) ) ; $ this -> queryResults [ $ this -> services [ $ key ] ] = $ response ; } catch ( TimeoutException $ e ) { $ this -> queryResults [ $ this -> services [ $ key ] ] = new Response ( $ e -> getMessage ( ) , 503 ) ; } catch ( \ Exception $ e ) { $ this -> queryResults [ $ this -> services [ $ key ] ] = new Response ( $ e -> getMessage ( ) , $ e -> getCode ( ) ) ; } } return $ this -> queryResults ; }
Resolve queries from queue
@param CommunicatorServiceInterface $communicatorService
@return Response[]
Resolve queries from queue