我通过Azure IoT DPS自动配置了一堆物联网设备 . 这些设备在我的物联网中心注册 . 所有设备都具有X.509证书身份验证 .
我现在想要做的是向设备发送消息 . 所有证书都可用,我可以将DeviceClient连接到集线器上的设备 . 这是我使用的Azure IoT Java SDK的方法:
public static DeviceClient createFromSecurityProvider(String uri, String deviceId, SecurityProvider securityProvider, IotHubClientProtocol protocol) throws URISyntaxException, IOException
它需要 SecurityProviderX509Cert 作为参数 .
但是,每个DeviceClient都有自己的物理连接 . 我想要的是使用这个构造函数使用AMQP多路复用:
public DeviceClient(String connString, TransportClient transportClient) throws URISyntaxException
这不适用于X.509设备 . 在连接字符串中,我使用了来自集线器的共享访问策略的共享访问密钥,但是遇到了异常:
Unauthorized: Device 'xxx' at IotHub 'yyy' does not have PrimaryKey or SecondaryKey
我认为只有在我使用对称密钥注册设备时才会有效 . 但是,这些设备无法通过Azure DPS自动注册 . 我只能使用X.509或TPM注册设备 .
那么如何通过单个AMQPS连接获得连接多个X.509设备的技巧呢?
1 回答
似乎Azure IoT Hub SDK for Java不支持X.509设备的多路复用 .
您可以在github上发布此功能的要求(https://github.com/Azure/azure-iot-sdk-java/issues) .