| | |
| | | try { |
| | | // host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存 |
| | | // String clientId =config.getClientid()+ Constants.getUUID(); |
| | | String clientId =config.getClientid()+"001"; |
| | | String clientId =config.getClientid()+(int)(Math.random()*10000); |
| | | client = new org.eclipse.paho.client.mqttv3.MqttClient(config.getHost(), clientId,new MemoryPersistence()); |
| | | // MQTT的连接设置 |
| | | MqttConnectOptions options = new MqttConnectOptions(); |
| | |
| | | try { |
| | | // host为主机名,clientid即连接MQTT的客户端ID,一般以唯一标识符表示,MemoryPersistence设置clientid的保存形式,默认为以内存保存 |
| | | // String clientId =config.getClientid()+ Constants.getUUID(); |
| | | String clientId =config.getSubclientid()+"001"; |
| | | String clientId =config.getClientid()+(int)(Math.random()*10000); |
| | | subClient = new org.eclipse.paho.client.mqttv3.MqttClient(config.getHost(), clientId,new MemoryPersistence()); |
| | | // MQTT的连接设置 |
| | | MqttConnectOptions options = new MqttConnectOptions(); |