繁体   English   中英

如何使 Azure 服务总线 Node.js 客户端通过 HTTPS(端口 443)而不是端口 5671 连接?

[英]How to make an Azure Service Bus Node.js client connect via HTTPS (port 443), not port 5671?

我们正在使用@azure/service-bus package 在 Node.js 应用程序中侦听 Azure 服务总线消息。 不幸的是,默认端口 5671 在我们的环境中被阻止。

根据此文档此问题,连接模式可以更改为 HTTPS(端口 443),至少从 .NET(可能还有 Java)更改为:

ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Https;

我们如何在基于 Node.js 的应用程序中实现相同的目标?

对于https支持,您需要使用WebSockets 尝试使用以下代码创建您的服务总线客户端:

const connectionString = 'your service bus connection string';
const connectionOptions = {
    webSocketOptions: {
        webSocket : WebSocket
    }
};
const serviceBusClient = new ServiceBusClient(connectionString, connectionOptions);

现在,您将使用https通过端口 443 而不是使用端口 5671 的AMQP连接到服务总线。

有关更多详细信息,请参阅ServiceBusClientOptionsServiceBusClient

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM