package com.tievd.jyz.mqtt.command; import com.tievd.jyz.constants.SystemConstant; import com.tievd.jyz.mqtt.MqttMsgSender; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * Mqtt命令执行者 * * @author Wang * */ @Slf4j @Component public class MqttCommandReceiver { @Autowired private MqttMsgSender mqttMsgSender; public int send(String data,String topic) { try { mqttMsgSender.sendToMqtt(data,topic); } catch (Exception e) { log.error("Mqtt请求出错", e.getMessage()); return SystemConstant.DEAL_FAIL; } return SystemConstant.DEAL_OK; } }