我有一个从某些设备收集数据的现场网关,我正在尝试将该数据发送到IOThub。网关在Camel中,因此我必须将发送数据作为组件发送到IOThub。我在Endpoint start()方法中添加了以下内容
connString= "xxxxxxxx";
protocol = IotHubClientProtocol.AMQPS;
System.out.println("In start2");
client = new DeviceClient(connString, protocol);
System.out.println("In start3");
client.open();
System.out.println("In start4");
从Producer获取交换数据并使用以下代码将其发送到端点中的方法
Message msg = new Message(payloadBytes);
Object lockobj = new Object();
EventCallback callback = new EventCallback();
client.sendEventAsync(msg, callback, lockobj);
当我运行测试路径(带有Hello world消息)时,数据会转到Iothub,但会显示下面的警告。但是当我运行网关时,它会挂起在client.open()...仅在start2和In start3中打印。在start4不是。
Sep 15, 2016 7:06:10 AM org.apache.qpid.proton.engine.impl.ssl.SslEngineFacadeFactory getClass
WARNING: unable to load org.bouncycastle.openssl.PEMReader
Sep 15, 2016 7:06:10 AM org.apache.qpid.proton.engine.impl.ssl.SslEngineFacadeFactory getClass
WARNING: unable to load org.bouncycastle.openssl.PasswordFinder
Sep 15, 2016 7:06:10 AM org.apache.qpid.proton.engine.impl.ssl.SslEngineFacadeFactory <clinit>
WARNING: unable to load bouncycastle provider
我在端点的stop()方法中添加了client.close()。也许我把开放和关闭放在错误的位置。请帮忙!!
答案 0 :(得分:0)
我必须添加以下依赖项
<dependency>
<groupId>com.microsoft.azure.iot</groupId>
<artifactId>proton-j-azure-iot</artifactId>
<version>0.12.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>