com.feingto.iot.client.service.MqttCallback Maven / Gradle / Ivy
package com.feingto.iot.client.service;
import com.feingto.iot.common.model.mqtt.SendMessage;
import com.feingto.iot.common.service.ResponseCallback;
/**
* MQTT 消息回调接口
*
* @author longfei
*/
public abstract class MqttCallback implements ResponseCallback {
protected abstract void messageArrived(String topic, String message);
protected abstract void exceptionCaught(Throwable cause);
@Override
public void onResponse(SendMessage message) {
messageArrived(message.topic(), new String(message.payload()));
}
@Override
public void onFailure(Throwable e) {
exceptionCaught(e);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy