类 MqttUtil
java.lang.Object
cn.hamm.airpower.util.MqttUtil
MQTT助手类
- 作者:
- Hamm.cn
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明@NotNull org.eclipse.paho.client.mqttv3.MqttClient创建MQTT客户端@NotNull org.eclipse.paho.client.mqttv3.MqttClientcreateClient(String id) 创建MQTT客户端org.eclipse.paho.client.mqttv3.MqttConnectOptions创建配置void发送消息
-
构造器详细资料
-
MqttUtil
public MqttUtil()
-
-
方法详细资料
-
createClient
@NotNull public @NotNull org.eclipse.paho.client.mqttv3.MqttClient createClient() throws org.eclipse.paho.client.mqttv3.MqttException创建MQTT客户端
- 返回:
- 配置
- 抛出:
org.eclipse.paho.client.mqttv3.MqttException- 异常
-
createClient
@NotNull public @NotNull org.eclipse.paho.client.mqttv3.MqttClient createClient(String id) throws org.eclipse.paho.client.mqttv3.MqttException 创建MQTT客户端
- 参数:
id- 客户端ID- 返回:
- 配置
- 抛出:
org.eclipse.paho.client.mqttv3.MqttException- 异常
-
createOption
public org.eclipse.paho.client.mqttv3.MqttConnectOptions createOption()创建配置
- 返回:
- 配置
-
publish
public void publish(@NotNull @NotNull String topic, @NotNull @NotNull String message) throws org.eclipse.paho.client.mqttv3.MqttException 发送消息
- 参数:
topic- 主题message- 消息内容- 抛出:
org.eclipse.paho.client.mqttv3.MqttException
-