【问题标题】:Azure SDK for PHP and Service Bus for Windows Server 1.1适用于 PHP 的 Azure SDK 和适用于 Windows Server 1.1 的服务总线
【发布时间】:2016-06-02 16:44:12
【问题描述】:

当前的 Azure SDK for PHP 是否支持 Windows Server 1.1 的服务总线? 如果是,应该如何配置才能成功连接并发布到总线?

我发现连接字符串中有一个附加参数,可以更改 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";

?>

【问题讨论】:

  • 据我所知,如果我们要使用 Azure 服务总线 SDK,端点格式类似于 '[yourNamespace].servicebus.windows.net'。如果您想使用 REST API,请参考此 C# 代码:stackoverflow.com/a/21754862/4836342
  • 使用 Azure 服务总线时是“[yourNamespace].servicebus.windows.net”。这是我要的本地版本,它是使用的服务器主机名。

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


【解决方案1】:

@Tsvetelin,

根据SDK官方文档,确认Azure Service bus SDK 2.1与service bus 1.1兼容。请看下图和文档(https://msdn.microsoft.com/en-us/library/dn441398.aspx)。

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

【讨论】:

  • 谢谢,但对于 .NET SDK 来说确实如此,并且在 .NET 世界中运行良好。我要的是 PHP Azure SDK,因为我们无法连接...
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-05-13
  • 2013-01-26
  • 2017-04-29
相关资源
最近更新 更多