【发布时间】:2017-06-08 13:41:08
【问题描述】:
目前我们想使用 RabbitMQ 访问我们的 Azure IoT-Hub。我们知道还有其他选择并且已经测试了一些,但是这个项目是为了测试它是否可能并且适合我们。
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
using System;
using System.Text;
我们的代码看起来有点像这样:
var factory = new ConnectionFactory();
factory.HostName = $"{IOT_HUB_NAME}.azure-devices.net";
// This fails with the message: 'None of the specified endpoints were reachable.'
using (var connection = factory.CreateConnection())
{
// ...
}
工厂想要连接的端点是:
amqp://<IoT-Hub Name>.azure-devices.net:5672
我们的 IT 部门已经检查了我们的文件墙:它没有阻止此连接。
使用 telnet 快速检查会导致连接错误:
telnet <IoT-Hub Name>.azure-devices.net 5672
但是,端口 5671(AMQP 需要的另一个端口)可用。
我已经尝试设置factory.Port = 5671,但没有成功。使用 Microsoft Azure IoT SDK 进行的另一项检查发现确实可以连接到 IoT-Hub。
这使我假设我要么错过了重要配置,要么可能无法使用 RabbitMQ 连接到 Azure IoT-Hub。
【问题讨论】:
标签: c# rabbitmq amqp iot azure-iot-hub