public function peekMessagesAsync(
        $queueName,
        PeekMessagesOptions $options = null
    ) {
        Validate::canCastAsString($queueName, 'queueName');
        Validate::notNullOrEmpty($queueName, 'queueName');

        $method      = Resources::HTTP_GET;
        $headers     = array();
        $queryParams = array();
        $postParams  = array();
        $path        = $queueName . '/messages';

        if (is_null($options)) {
            $options = new PeekMessagesOptions();
        }

        $messagesCount = $options->getNumberOfMessages();

        $this->addOptionalQueryParam($queryParams, Resources::QP_PEEK_ONLY, 'true');
        $this->addOptionalQueryParam(
            $queryParams,
            Resources::QP_NUM_OF_MESSAGES,
            $messagesCount
        );

        $dataSerializer = $this->dataSerializer;

        return $this->sendAsync(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            Resources::STATUS_OK,
            Resources::EMPTY_STRING,
            $options
        )->then(function ($response) use ($dataSerializer) {
            $parsed = $dataSerializer->unserialize($response->getBody());
            return PeekMessagesResult::create($parsed);
        }, null);
    }
public function peekMessagesAsync(
        $queueName,
        PeekMessagesOptions $options = null
    ) {
        Validate::canCastAsString($queueName, 'queueName');
        Validate::notNullOrEmpty($queueName, 'queueName');

        $method      = Resources::HTTP_GET;
        $headers     = array();
        $queryParams = array();
        $postParams  = array();
        $path        = $queueName . '/messages';

        if (is_null($options)) {
            $options = new PeekMessagesOptions();
        }

        $messagesCount = $options->getNumberOfMessages();

        $this->addOptionalQueryParam($queryParams, Resources::QP_PEEK_ONLY, 'true');
        $this->addOptionalQueryParam(
            $queryParams,
            Resources::QP_NUM_OF_MESSAGES,
            $messagesCount
        );

        $dataSerializer = $this->dataSerializer;

        return $this->sendAsync(
            $method,
            $headers,
            $queryParams,
            $postParams,
            $path,
            Resources::STATUS_OK,
            Resources::EMPTY_STRING,
            $options
        )->then(function ($response) use ($dataSerializer) {
            $parsed = $dataSerializer->unserialize($response->getBody());
            return PeekMessagesResult::create($parsed);
        }, null);
    }
public function peekMessagesAsync ( $ queueName , PeekMessagesOptions $ options = null ) { Validate :: canCastAsString ( $ queueName , 'queueName' ) ; Validate :: notNullOrEmpty ( $ queueName , 'queueName' ) ; $ method = Resources :: HTTP_GET ; $ headers = array ( ) ; $ queryParams = array ( ) ; $ postParams = array ( ) ; $ path = $ queueName . '/messages' ; if ( is_null ( $ options ) ) { $ options = new PeekMessagesOptions ( ) ; } $ messagesCount = $ options -> getNumberOfMessages ( ) ; $ this -> addOptionalQueryParam ( $ queryParams , Resources :: QP_PEEK_ONLY , 'true' ) ; $ this -> addOptionalQueryParam ( $ queryParams , Resources :: QP_NUM_OF_MESSAGES , $ messagesCount ) ; $ dataSerializer = $ this -> dataSerializer ; return $ this -> sendAsync ( $ method , $ headers , $ queryParams , $ postParams , $ path , Resources :: STATUS_OK , Resources :: EMPTY_STRING , $ options ) -> then ( function ( $ response ) use ( $ dataSerializer ) { $ parsed = $ dataSerializer -> unserialize ( $ response -> getBody ( ) ) ; return PeekMessagesResult :: create ( $ parsed ) ; } , null ) ; }
Creates promise to retrieve a message from the front of the queue,
without changing the message visibility.

@param string              $queueName The queue name.
@param PeekMessagesOptions $options   The optional parameters.

@return \GuzzleHttp\Promise\PromiseInterface
Creates promise to retrieve a message from the front of the queue without changing the message visibility .