|
@@ -42,6 +42,9 @@ public class IotSubscribe { |
|
|
private long timeStamp; |
|
|
private long timeStamp; |
|
|
//签名方法:支持hmacmd5、hmacsha1和hmacsha256。 |
|
|
//签名方法:支持hmacmd5、hmacsha1和hmacsha256。 |
|
|
private String signMethod; |
|
|
private String signMethod; |
|
|
|
|
|
private String uId; |
|
|
|
|
|
private String regionId; |
|
|
|
|
|
private String productKey; |
|
|
private String clientId; |
|
|
private String clientId; |
|
|
private String iotHost; |
|
|
private String iotHost; |
|
|
private String iotPort; |
|
|
private String iotPort; |
|
@@ -65,6 +68,9 @@ public class IotSubscribe { |
|
|
this.iotInstanceId = environment.getProperty("iot.iotInstanceId"); |
|
|
this.iotInstanceId = environment.getProperty("iot.iotInstanceId"); |
|
|
//签名方法:支持hmacmd5、hmacsha1和hmacsha256。 |
|
|
//签名方法:支持hmacmd5、hmacsha1和hmacsha256。 |
|
|
this.signMethod = environment.getProperty("iot.signMethod"); |
|
|
this.signMethod = environment.getProperty("iot.signMethod"); |
|
|
|
|
|
this.uId = environment.getProperty("iot.uId"); |
|
|
|
|
|
this.regionId = environment.getProperty("iot.regionId"); |
|
|
|
|
|
this.productKey = environment.getProperty("iot.productKey"); |
|
|
this.clientId = environment.getProperty("iot.clientId"); |
|
|
this.clientId = environment.getProperty("iot.clientId"); |
|
|
this.iotHost = environment.getProperty("iot.iotHost"); |
|
|
this.iotHost = environment.getProperty("iot.iotHost"); |
|
|
this.iotPort = environment.getProperty("iot.iotPort"); |
|
|
this.iotPort = environment.getProperty("iot.iotPort"); |
|
@@ -84,7 +90,8 @@ public class IotSubscribe { |
|
|
String password = doSign(signContent,accessSecret, signMethod); |
|
|
String password = doSign(signContent,accessSecret, signMethod); |
|
|
|
|
|
|
|
|
//接入域名,请参见AMQP客户端接入说明文档。 |
|
|
//接入域名,请参见AMQP客户端接入说明文档。 |
|
|
String connectionUrl = "failover:(amqps://" + iotHost + ":" + iotPort |
|
|
|
|
|
|
|
|
String host = uId + ".iot-amqp." + regionId + ".aliyuncs.com"; |
|
|
|
|
|
String connectionUrl = "failover:(amqps://" + host + ":" + iotPort |
|
|
+ "?amqp.idleTimeout=80000)" |
|
|
+ "?amqp.idleTimeout=80000)" |
|
|
+ "?failover.reconnectDelay=30"; |
|
|
+ "?failover.reconnectDelay=30"; |
|
|
|
|
|
|
|
|