| | |
| | | */ |
| | | static MqttClientOptions getBasicClientOptions() { |
| | | if (!mqtt.containsKey(MqttUseEnum.BASIC)) { |
| | | throw new Error("Please configure the basic mqtt connection parameters first, otherwise application cannot be started."); |
| | | throw new Error("请先配置基本的mqtt连接参数,否则应用程序无法启动。"); |
| | | } |
| | | return mqtt.get(MqttUseEnum.BASIC); |
| | | } |
| | |
| | | */ |
| | | public static MqttBrokerDTO getMqttBrokerWithDrc(String clientId, String username, Long age, Map<String, ?> map) { |
| | | if (!mqtt.containsKey(MqttUseEnum.DRC)) { |
| | | throw new RuntimeException("Please configure the drc link parameters of mqtt in the backend configuration file first."); |
| | | throw new RuntimeException("请先在后端配置文件中配置mqtt的drc链接参数。"); |
| | | } |
| | | Algorithm algorithm = JwtUtil.algorithm; |
| | | |
| | |
| | | |
| | | return MqttBrokerDTO.builder() |
| | | .address(getMqttAddress(mqtt.get(MqttUseEnum.DRC))) |
| | | .username(username) |
| | | .username("root") |
| | | .clientId(clientId) |
| | | .expireTime(System.currentTimeMillis() / 1000 + age) |
| | | .password(token) |
| | | .password("root") |
| | | .build(); |
| | | } |
| | | |