[英]How to make an Azure Service Bus Node.js client connect via HTTPS (port 443), not port 5671?
We are using the @azure/service-bus
package to listen for Azure Service Bus messages in a Node.js application.我们正在使用
@azure/service-bus
package 在 Node.js 应用程序中侦听 Azure 服务总线消息。 Unfortunately the default port 5671 is blocked in our environment.不幸的是,默认端口 5671 在我们的环境中被阻止。
According to this documentation and this question the connectivity mode can be changed to HTTPS (port 443), at least from .NET (and maybe Java) like so:根据此文档和此问题,连接模式可以更改为 HTTPS(端口 443),至少从 .NET(可能还有 Java)更改为:
ServiceBusEnvironment.SystemConnectivity.Mode = ConnectivityMode.Https;
How can we achieve the same in a Node.js based application?我们如何在基于 Node.js 的应用程序中实现相同的目标?
For https
support, you will need to use WebSockets
.对于
https
支持,您需要使用WebSockets
。 Try to create your Service Bus client using the code below:尝试使用以下代码创建您的服务总线客户端:
const connectionString = 'your service bus connection string';
const connectionOptions = {
webSocketOptions: {
webSocket : WebSocket
}
};
const serviceBusClient = new ServiceBusClient(connectionString, connectionOptions);
Now you'll be connecting to your Service Bus using https
over port 443 instead of AMQP
using port 5671.现在,您将使用
https
通过端口 443 而不是使用端口 5671 的AMQP
连接到服务总线。
For more details, please see ServiceBusClientOptions
and ServiceBusClient
.有关更多详细信息,请参阅
ServiceBusClientOptions
和ServiceBusClient
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.