use of org.apache.rocketmq.iot.common.data.Message in project rocketmq-externals by apache.
the class MessageUtil method getMessage.
public static Message getMessage(MqttMessage mqttMessage) {
Message message = new Message();
message.setPayload(mqttMessage);
switch(mqttMessage.fixedHeader().messageType()) {
case CONNECT:
message.setType(Message.Type.MQTT_CONNECT);
break;
case CONNACK:
message.setType(Message.Type.MQTT_CONNACK);
break;
case PUBLISH:
message.setType(Message.Type.MQTT_PUBLISH);
break;
case PUBACK:
message.setType(Message.Type.MQTT_PUBACK);
break;
case PUBREC:
message.setType(Message.Type.MQTT_PUBREC);
break;
case PUBREL:
message.setType(Message.Type.MQTT_PUBREL);
break;
case PUBCOMP:
message.setType(Message.Type.MQTT_PUBCOMP);
case SUBSCRIBE:
message.setType(Message.Type.MQTT_SUBSCRIBE);
break;
case SUBACK:
message.setType(Message.Type.MQTT_SUBACK);
break;
case UNSUBSCRIBE:
message.setType(Message.Type.MQTT_UNSUBSCRIBE);
break;
case UNSUBACK:
message.setType(Message.Type.MQTT_UNSUBACK);
break;
case PINGREQ:
message.setType(Message.Type.MQTT_PINGREQ);
break;
case PINGRESP:
message.setType(Message.Type.MQTT_PINGRESP);
break;
case DISCONNECT:
message.setType(Message.Type.MQTT_DISCONNECT);
break;
default:
}
return message;
}
Aggregations