-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
13 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,10 +7,10 @@ | |
|
||
/** | ||
* 真实反馈类 | ||
* * 异步执行数据请求 | ||
* * 1. 获取是否需要反馈,有反馈监听才需要添加反馈 | ||
* * 2. 无需反馈,直接发送完成 | ||
* * 3. 需要反馈,添加任务队列Map<name,listener> | ||
* * 异步执行数据请求 | ||
* * 1. 获取是否需要反馈,有反馈监听才需要添加反馈 | ||
* * 2. 无需反馈,直接发送完成 | ||
* * 3. 需要反馈,添加任务队列Map<name,listener> | ||
* | ||
* @Author: sheedon | ||
* @Email: [email protected] | ||
|
@@ -27,6 +27,7 @@ protected RealCall(RealClient client, Request originalRequest) { | |
this.client = client; | ||
this.originalRequest = originalRequest; | ||
} | ||
|
||
/** | ||
* 新增反馈类 | ||
*/ | ||
|
@@ -86,7 +87,7 @@ public Call clone() { | |
return null; | ||
} | ||
|
||
final class AsyncCall extends NamedRunnable implements AsyncCallImpl{ | ||
final class AsyncCall extends NamedRunnable implements AsyncCallImpl { | ||
|
||
private final Callback responseCallback; | ||
private final RealClient client; | ||
|
@@ -153,6 +154,11 @@ protected void execute() { | |
String topic = request.topic(); | ||
if (topic == null || topic.isEmpty()) | ||
topic = mqttClient.baseTopic(); | ||
|
||
if (mqttClient == null || mqttClient.mqttClient() == null) { | ||
client.dispatcher().finishedByLocal(id(), new Throwable("mqtt client is null")); | ||
return; | ||
} | ||
mqttClient.mqttClient().publish(topic, | ||
request.getBody()); | ||
|
||
|