数据处理模块新增
parent
dc19916bca
commit
702817e275
|
@ -7,7 +7,7 @@ public class ReceiveTwo {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String topic = "vehicle";
|
String topic = "vehicle";
|
||||||
String broker = "tcp://47.101.53.251:1883";
|
String broker = "tcp://47.101.53.251:1883";
|
||||||
String clientId="lxy";
|
String clientId="lw";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
MqttClient mqttClient= new MqttClient(broker,clientId);
|
MqttClient mqttClient= new MqttClient(broker,clientId);
|
||||||
|
@ -15,12 +15,9 @@ public class ReceiveTwo {
|
||||||
connectOptions.setCleanSession(true);
|
connectOptions.setCleanSession(true);
|
||||||
System.out.println("Connecting to broker:" + broker);
|
System.out.println("Connecting to broker:" + broker);
|
||||||
mqttClient.connect(connectOptions);
|
mqttClient.connect(connectOptions);
|
||||||
|
|
||||||
System.out.println("已连接");
|
System.out.println("已连接");
|
||||||
|
|
||||||
mqttClient.setCallback(new MqttCallback(){
|
mqttClient.setCallback(new MqttCallback(){
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connectionLost(Throwable throwable) {
|
public void connectionLost(Throwable throwable) {
|
||||||
System.out.println("Connect lost!");
|
System.out.println("Connect lost!");
|
||||||
|
|
Loading…
Reference in New Issue