public function execute(Request $request): Response
    {
        $method = $request->getMethod();
        list($resp, $grpcStatus) = $request->getClient()->$method(
            $request->getMessage(),
            $request->getMetadata(),
            $request->getOptions()
        )->wait();

        $headers = new HeaderCollection();

        if (is_null($grpcStatus)) { // in the very bad case even this fails to return
            $status = new Error\Status(\Grpc\STATUS_UNKNOWN, '', $headers);
        } else {
            $metadata = $grpcStatus->metadata;
            foreach ($metadata as $k => $v) {
                if (is_array($v)) {
                    foreach ($v as $v2) {
                        $headers->add($k, $v2);
                    }
                } else {
                    $headers->add($k, $v);
                }
            }
            $status = new Error\Status(intval($grpcStatus->code), strval($grpcStatus->details), $headers);
        }

        if (is_null($resp)) {
            $request->fail($status);
        }

        return $request->succeed($resp, $status);
    }
public function execute(Request $request): Response
    {
        $method = $request->getMethod();
        list($resp, $grpcStatus) = $request->getClient()->$method(
            $request->getMessage(),
            $request->getMetadata(),
            $request->getOptions()
        )->wait();

        $headers = new HeaderCollection();

        if (is_null($grpcStatus)) { // in the very bad case even this fails to return
            $status = new Error\Status(\Grpc\STATUS_UNKNOWN, '', $headers);
        } else {
            $metadata = $grpcStatus->metadata;
            foreach ($metadata as $k => $v) {
                if (is_array($v)) {
                    foreach ($v as $v2) {
                        $headers->add($k, $v2);
                    }
                } else {
                    $headers->add($k, $v);
                }
            }
            $status = new Error\Status(intval($grpcStatus->code), strval($grpcStatus->details), $headers);
        }

        if (is_null($resp)) {
            $request->fail($status);
        }

        return $request->succeed($resp, $status);
    }
public function execute ( Request $ request ) : Response { $ method = $ request -> getMethod ( ) ; list ( $ resp , $ grpcStatus ) = $ request -> getClient ( ) -> $ method ( $ request -> getMessage ( ) , $ request -> getMetadata ( ) , $ request -> getOptions ( ) ) -> wait ( ) ; $ headers = new HeaderCollection ( ) ; if ( is_null ( $ grpcStatus ) ) { // in the very bad case even this fails to return $ status = new Error \ Status ( \ Grpc \ STATUS_UNKNOWN , '' , $ headers ) ; } else { $ metadata = $ grpcStatus -> metadata ; foreach ( $ metadata as $ k => $ v ) { if ( is_array ( $ v ) ) { foreach ( $ v as $ v2 ) { $ headers -> add ( $ k , $ v2 ) ; } } else { $ headers -> add ( $ k , $ v ) ; } } $ status = new Error \ Status ( intval ( $ grpcStatus -> code ) , strval ( $ grpcStatus -> details ) , $ headers ) ; } if ( is_null ( $ resp ) ) { $ request -> fail ( $ status ) ; } return $ request -> succeed ( $ resp , $ status ) ; }
Execute an outbound gRPC request

@param Request $request
@return Response
@throws Error
Execute an outbound gRPC request