4 changed files with 42 additions and 40 deletions
Split View
Diff Options
-
2root-cloud-event/src/main/java/com/qniao/iot/rc/RootCloudIotDataReceiptedEvent.java
-
14root-cloud-statistics/src/main/java/com/qniao/iot/rc/RootCloudIotDataFormatterJob.java
-
33root-cloud-statistics/src/main/java/com/qniao/iot/rc/event/RootCloudIotDataReceiptedEventDeserializationSchema.java
-
33root-cloud-statistics/src/main/java/com/qniao/iot/rc/event/RootCloudReceiptedEventDeserializationSchema.java
@ -0,0 +1,33 @@ |
|||
package com.qniao.iot.rc.event; |
|||
|
|||
import com.qniao.iot.rc.RootCloudIotDataReceiptedEvent; |
|||
import org.apache.flink.api.common.serialization.DeserializationSchema; |
|||
import org.apache.flink.api.common.typeinfo.TypeInformation; |
|||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import java.io.IOException; |
|||
|
|||
/** |
|||
* @author Lzk |
|||
*/ |
|||
public class RootCloudIotDataReceiptedEventDeserializationSchema implements DeserializationSchema<RootCloudIotDataReceiptedEvent> { |
|||
/** |
|||
* 注册JavaTimeModule,支持LocalDateTime字段的解析 |
|||
*/ |
|||
final private ObjectMapper objectMapper = new ObjectMapper(); |
|||
|
|||
@Override |
|||
public RootCloudIotDataReceiptedEvent deserialize(byte[] message) throws IOException { |
|||
return objectMapper.readValue(message, RootCloudIotDataReceiptedEvent.class); |
|||
} |
|||
|
|||
@Override |
|||
public boolean isEndOfStream(RootCloudIotDataReceiptedEvent nextElement) { |
|||
return false; |
|||
} |
|||
|
|||
@Override |
|||
public TypeInformation<RootCloudIotDataReceiptedEvent> getProducedType() { |
|||
return TypeInformation.of(RootCloudIotDataReceiptedEvent.class); |
|||
} |
|||
} |
|||
@ -1,33 +0,0 @@ |
|||
package com.qniao.iot.rc.event; |
|||
|
|||
import com.qniao.iot.rc.RootCloudReceiptedEvent; |
|||
import org.apache.flink.api.common.serialization.DeserializationSchema; |
|||
import org.apache.flink.api.common.typeinfo.TypeInformation; |
|||
import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper; |
|||
|
|||
import java.io.IOException; |
|||
|
|||
/** |
|||
* @author Lzk |
|||
*/ |
|||
public class RootCloudReceiptedEventDeserializationSchema implements DeserializationSchema<RootCloudReceiptedEvent> { |
|||
/** |
|||
* 注册JavaTimeModule,支持LocalDateTime字段的解析 |
|||
*/ |
|||
final private ObjectMapper objectMapper = new ObjectMapper(); |
|||
|
|||
@Override |
|||
public RootCloudReceiptedEvent deserialize(byte[] message) throws IOException { |
|||
return objectMapper.readValue(message, RootCloudReceiptedEvent.class); |
|||
} |
|||
|
|||
@Override |
|||
public boolean isEndOfStream(RootCloudReceiptedEvent nextElement) { |
|||
return false; |
|||
} |
|||
|
|||
@Override |
|||
public TypeInformation<RootCloudReceiptedEvent> getProducedType() { |
|||
return TypeInformation.of(RootCloudReceiptedEvent.class); |
|||
} |
|||
} |
|||
Write
Preview
Loading…
Cancel
Save