|
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.util.ByteUtil; |
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.qniao.iot.rc.RootCloudIotDataReceiptedEvent; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.flink.api.common.serialization.DeserializationSchema; |
|
|
|
import org.apache.flink.api.common.typeinfo.TypeInformation; |
|
|
|
|
|
|
|
@ -12,6 +13,7 @@ import java.io.IOException; |
|
|
|
/** |
|
|
|
* @author Lzk |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
public class RootCloudIotDataReceiptedEventDeserializationSchema implements DeserializationSchema<RootCloudIotDataReceiptedEvent> { |
|
|
|
/** |
|
|
|
* 注册JavaTimeModule,支持LocalDateTime字段的解析 |
|
|
|
@ -21,6 +23,7 @@ public class RootCloudIotDataReceiptedEventDeserializationSchema implements Dese |
|
|
|
@Override |
|
|
|
public RootCloudIotDataReceiptedEvent deserialize(byte[] message) throws IOException { |
|
|
|
|
|
|
|
log.info("接受的设备数据:{}", JSONUtil.toJsonStr(message)); |
|
|
|
return objectMapper.readValue(message, RootCloudIotDataReceiptedEvent.class); |
|
|
|
} |
|
|
|
|
|
|
|
|