Windows Azure PHP Queue REST Proxy Limit

折月煮酒 提交于 2020-01-15 09:22:31

问题


I am writing a job processor to dequeue from Windows Azure Queue Storage using Azure PHP SDK. The job just try to fetch 32 messages in a batch, process them, and then delete the messages from the queue, and the repeat these steps. However, for each time I run the PHP script, the errors below is throw after the loop has run for exactly 27 times:

PHP Fatal error:  Uncaught HTTP_Request2_MessageException: Malformed response:  in /usr/share/php/HTTP/Request2/Adapter/Socket.php on line 1013
#0 /usr/share/php/HTTP/Request2/Adapter/Socket.php(1013): HTTP_Request2_Response->__construct('', true, Object(Net_URL2))
#1 /usr/share/php/HTTP/Request2/Adapter/Socket.php(136): HTTP_Request2_Adapter_Socket->readResponse()
#2 /usr/share/php/HTTP/Request2.php(939): HTTP_Request2_Adapter_Socket->sendRequest(Object(HTTP_Request2))
#3 /usr/share/php/WindowsAzure/Common/Internal/Http/HttpClient.php(262): HTTP_Request2->send()
#4 /usr/share/php/WindowsAzure/Common/Internal/RestProxy.php(141): WindowsAzure\Common\Internal\Http\HttpClient->send(Array, Object(WindowsAzure\Common\Internal\Http\Url))
#5 /usr/share/php/WindowsAzure/Common/Internal/ServiceRestProxy.php(86): WindowsAzure\Common\Internal\RestProxy->sendContext(Object(WindowsAzure\Common\Internal\Http\HttpCallContext))
#6 /usr/share/php/WindowsAzure/Common/Internal/ServiceRestProxy.php(125): WindowsAzure\Common\Internal\ServiceRestPr in /usr/share/php/HTTP/Request2/Response.php on line 215

Any Azure expert could help me?


回答1:


In order to bypass the connection limit for HTTPS on Azure Storage operations (including the storage query, or say a block blob chunked upload), you need to set the azure blob service connection string to http.

You can do something like this (pass in false before doing a multi-operation call):

function getBlobStorageProxy($secure = true) {
    if ($secure) {
      $connectionString = "DefaultEndpointsProtocol=https;AccountName=[AccountName];AccountKey=[AccountKey]";
    } else {
      $connectionString = "DefaultEndpointsProtocol=http;AccountName=[AccountName];AccountKey=[AccountKey]";
    }

    $this->serviceBuilder = ServicesBuilder::getInstance();
    return $this->serviceBuilder->createBlobService($connectionString);
}


来源:https://stackoverflow.com/questions/25762907/windows-azure-php-queue-rest-proxy-limit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!