src/JsonRpc/JsonRpcClient.php
public function addRequest(Request $request)
    {
        $attributes = $this->createAttributes($request);

        $exchange = $this->getExchange($request->server());

        $message = json_encode($request->params());

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new Exception\InvalidArgumentException('Error during json encoding');
        }

        $exchange->publish($message, $request->routingKey(), Constants::AMQP_NOPARAM, $attributes);

        if (null !== $request->id()) {
            $this->requestIds[] = $request->id();
        }

        if (0 !== $request->expiration() && ceil($request->expiration() / 1000) > $this->timeout) {
            $this->timeout = ceil($request->expiration() / 1000);
        }

        ++$this->countRequests;
    }
public function addRequest(Request $request)
    {
        $attributes = $this->createAttributes($request);

        $exchange = $this->getExchange($request->server());

        $message = json_encode($request->params());

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new Exception\InvalidArgumentException('Error during json encoding');
        }

        $exchange->publish($message, $request->routingKey(), Constants::AMQP_NOPARAM, $attributes);

        if (null !== $request->id()) {
            $this->requestIds[] = $request->id();
        }

        if (0 !== $request->expiration() && ceil($request->expiration() / 1000) > $this->timeout) {
            $this->timeout = ceil($request->expiration() / 1000);
        }

        ++$this->countRequests;
    }
public function addRequest ( Request $ request ) { $ attributes = $ this -> createAttributes ( $ request ) ; $ exchange = $ this -> getExchange ( $ request -> server ( ) ) ; $ message = json_encode ( $ request -> params ( ) ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new Exception \ InvalidArgumentException ( 'Error during json encoding' ) ; } $ exchange -> publish ( $ message , $ request -> routingKey ( ) , Constants :: AMQP_NOPARAM , $ attributes ) ; if ( null !== $ request -> id ( ) ) { $ this -> requestIds [ ] = $ request -> id ( ) ; } if ( 0 !== $ request -> expiration ( ) && ceil ( $ request -> expiration ( ) / 1000 ) > $ this -> timeout ) { $ this -> timeout = ceil ( $ request -> expiration ( ) / 1000 ) ; } ++ $ this -> countRequests ; }
Add a request to rpc client

@param Request $request
@throws Exception\InvalidArgumentException
Add a request to rpc client