用于PHP的Azure SDK和用于Windows Server 1.1的Service Bus

时间:2016-06-02 16:44:13

标签: php azure azureservicebus servicebus azure-sdk-php

当前的Azure SDK for PHP是否支持Windows Server 1.1的Service Bus? 如果确实如此,应如何配置以便成功连接并发布到总线?

我发现连接字符串中有一个附加参数,可以更改StsEndpoint,我用它来使用服务总线的STS,但我收到了<Error><Code>404</Code><Detail>No service is hosted at the specified address..

我正在使用的代码:

<?php

echo "Here we go...\n";

require_once 'vendor/autoload.php';

use WindowsAzure\Common\ServicesBuilder;
use WindowsAzure\Common\ServiceException;
use WindowsAzure\ServiceBus\Models\BrokeredMessage;

echo "Create Service Bus REST proxy.\n";

$connectionString = 'Endpoint=sb://myhost.mydomain/myNamespace;StsEndpoint=https://myhost.mydomain:9355/myNamespace;SharedSecretIssuer=theSASName;SharedSecretValue=theSASKey';

$serviceBusRestProxy = ServicesBuilder::getInstance()->createServiceBusService($connectionString);


try {
    echo "Create message. \n";
    $message = new BrokeredMessage();
    $message->setBody("my message");

    echo "Send message. \n";
    $serviceBusRestProxy->sendQueueMessage("my-queue", $message);
} catch(ServiceException $e) {
    $code = $e->getCode();
    $error_message = $e->getMessage();
    echo $code . ": " . $error_message .";\n";
}

echo "The End! \n";

?>

1 个答案:

答案 0 :(得分:0)

@Tsvetelin,

根据关于SDK的官方文档,确认Azure Service bus SDK 2.1与服务总线1.1兼容。请参阅下面的图片和文档(enter image description here)。 https://msdn.microsoft.com/en-us/library/dn441398.aspx

另一个潜在问题是,我建议您可以使用'Get-SBFarmStatus'检查您的服务是否正在运行。任何更新,请告诉我。