mirror of
https://github.com/emqx/neuron.git
synced 2026-10-27 12:28:44 +08:00
feat(mqtt): use QoS setting for message delivery
This commit is contained in:
@@ -373,7 +373,7 @@ int handle_write_response(neu_plugin_t *plugin, neu_json_mqtt_t *mqtt_json,
|
||||
}
|
||||
|
||||
char * topic = plugin->write_resp_topic;
|
||||
neu_mqtt_qos_e qos = NEU_MQTT_QOS0;
|
||||
neu_mqtt_qos_e qos = plugin->config.qos;
|
||||
rv = publish(plugin, qos, topic, json_str, strlen(json_str));
|
||||
json_str = NULL;
|
||||
|
||||
@@ -455,7 +455,7 @@ int handle_read_response(neu_plugin_t *plugin, neu_json_mqtt_t *mqtt_json,
|
||||
}
|
||||
|
||||
char * topic = plugin->read_resp_topic;
|
||||
neu_mqtt_qos_e qos = NEU_MQTT_QOS0;
|
||||
neu_mqtt_qos_e qos = plugin->config.qos;
|
||||
rv = publish(plugin, qos, topic, json_str, strlen(json_str));
|
||||
json_str = NULL;
|
||||
|
||||
@@ -496,7 +496,7 @@ int handle_trans_data(neu_plugin_t * plugin,
|
||||
}
|
||||
|
||||
char * topic = route->topic;
|
||||
neu_mqtt_qos_e qos = NEU_MQTT_QOS0;
|
||||
neu_mqtt_qos_e qos = plugin->config.qos;
|
||||
rv = publish(plugin, qos, topic, json_str, strlen(json_str));
|
||||
json_str = NULL;
|
||||
|
||||
|
||||
@@ -286,16 +286,18 @@ static int mqtt_plugin_start(neu_plugin_t *plugin)
|
||||
}
|
||||
|
||||
if (0 !=
|
||||
neu_mqtt_client_subscribe(plugin->client, 0, plugin->read_req_topic,
|
||||
plugin, handle_read_req)) {
|
||||
neu_mqtt_client_subscribe(plugin->client, plugin->config.qos,
|
||||
plugin->read_req_topic, plugin,
|
||||
handle_read_req)) {
|
||||
plog_error(plugin, "subscribe [%s] fail", plugin->read_req_topic);
|
||||
rv = NEU_ERR_MQTT_SUBSCRIBE_FAILURE;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (0 !=
|
||||
neu_mqtt_client_subscribe(plugin->client, 0, plugin->write_req_topic,
|
||||
plugin, handle_write_req)) {
|
||||
neu_mqtt_client_subscribe(plugin->client, plugin->config.qos,
|
||||
plugin->write_req_topic, plugin,
|
||||
handle_write_req)) {
|
||||
plog_error(plugin, "subscribe [%s] fail", plugin->write_req_topic);
|
||||
rv = NEU_ERR_MQTT_SUBSCRIBE_FAILURE;
|
||||
goto end;
|
||||
|
||||
Reference in New Issue
Block a user